Skip to navigation | Skip to content



Archive for October 2009

Control your own WordPress custom fields

I’m currently working on a client’s WordPress site where there’s quite a few bits of custom functionality in my custom theme that rely on them entering values for posts or pages using WP’s custom fields.

Custom fields are really flexible. However, they’re not perfectly user-friendly. For instance, if no post or page is currently using a custom field that you’ve built functionality on, the user has to enter the name as well as the value of the field the first time it’s used. The drop-down of field names is dynamically gathered from the fields currently in use. Also, sometimes you want to make things easier for clients by having inline tips, and inputs that suit the field (e.g. a checkbox or select drop-down instead of just a plain text entry).

So, I set about piecing together a way to take over the Custom Fields meta box…

Read more »

Get WordPress users by role

There’s a few posts around that reveal a nifty use of the WP_User_Search class that’s part of WordPress’ core code, in order to select all users that have a specific role (the trick seems to have originated with John Kolbert).

But… WP_User_Search is only loaded when you’re inside the WP admin area. What about front-end template code?

Read more »

New WordPress plugin: Lock Pages

I’m very please to announce my first WordPress plugin! It’s called Lock Pages.

The idea came from work with various clients where certain pages started to get moved around, or just vanished. A page can “move” by having its parent page or the slug changed. Sometimes clients would delete a page and replace it with an updated version which had a slightly different slug.

Of course, many of these things just stem from usually harmless habits picked up from working with files on a computer. But on a website, you want to persist your URLs as long as possible. Unless absolutely necessary, pages should be kept with the same permalink, to avoid breaking links and to maximize PageRank and such like.

Read more »

Plugins that detect whether they’re being used

There’s been a few posts round and about recently with people chipping in to make suggestions for WordPress plugins. Here’s my tuppence worth…

Read more »

WordPress server requirements

WordPress has famously low-level basic server requirements. However, most projects I deploy—because of plugins I rely on and other aspects—usually need a little more for “ideal” hosting.

Someone else used to maintain a really good “ideal” WP requirements page, but it seems to have vanished from their site. I thought I’d start my own, for my reference, to point potential clients to, and maybe of use to others.

Read more »

Double slashes in Analytics URLs

double-slash

I’ve just been dealing with an issue on a site where Google Analytics is logging a lot of pages twice, once normally and once with a double slash—”//”—at the end.

Obviously this is worrying. If Google is seeing the same page in two “places” via two technically different URLs, duplicate content penalties and PageRank squandering are distinct possibilities. It also seems to break a lot of the Analytics “Site Overlay” functionality.

Here I’m going to go through what I’ve done to isolate the cause of the issue, and approaches to fixing it.

Read more »

WordPress dashboard widget for PHP errors log

Jeff Starr recently posted on ways to monitor PHP errors. For some reason his method using WordPress’s wp-config.php file didn’t work for me, but I got the .htaccess version working OK.

I thought I’d knock out some code to display the latest errors as a widget on the WordPress dashboard.

As usual, this code is provided “as is”—use as you will, and let me know about any problems, but I can’t really offer support to people who aren’t comfortable with WordPress theme development. If anyone finds the time to wrap this up into a user-friendly plugin, do let me know (likewise if there’s already a plugin that does this better—I’ve not looked properly!).

Read more »

More archives