WordPress


Single Column Gallery in WordPress

Saturday, 25th September 2010

You may (or may not) have noticed that in WordPress if you want to insert an image gallery into your post it does not give you the option of insert a gallery only 1 column wide.

This seems like an oversight. I have seen loads of photo and inspiration blogs around that often include multiple images in a single column so it would seem that being able to easily insert a single column gallery would be a useful feature.

Fortunately it is possible to insert a gallery one column wide, just not through the popup media window. Here’s how…

Read the rest of this entry »


Setting a short menu name when registering a new custom post type in WordPress

Wednesday, 15th September 2010

When registering a new custom post type in WordPress, there are a whole array of labels you can set for how your post type will be displayed in the admin.

The post type I was creating had quite a long descriptive label which was fine in most scenarios but in the case of the main admin menu it pushed the menu text onto several lines.

See the example on the left below – I have deliberately shown any extremely long title to illustrate the point.

It would be really useful to have an extra label for ‘menu-name’ so that you can use a different title for the menu item as illustrated in the example on the right.

I have submitted a WordPress patch which Andrew Nacin seems to have taken under his wing. You can follow the progress of the patch here.

dentist new york city

Using HeadSpace with Custom Post Types

Tuesday, 14th September 2010

I frequently install HeadSpace, the WordPress SEO plugin by John Godley, when I work on a WordPress site.

Recently I have been making use of the new custom post type features of WordPress 3.0 but found that the HeadSpace meta box for editing the title and description tags did not show on my custom post type edit screens.

After a bit of delving through the code I figured out the way to do this – note that this may only work if your custom post type uses the default post capabilities.

It checks that the HeadSpace class is available and if so adds the meta box to your custom post type edit screen. Just add the following code into your plugin or theme’s functions.php file replacing ‘myposttype’ with your custom post type.

/**
 * Add Headspace plugin support for myposttype
 */
function myposttype_headpspace_add_custom_box() {
 
	global $headspace2;
 
	if ( function_exists( 'add_meta_box' ) && is_object( $headspace2 ) ) {
		add_meta_box( 'headspacestuff', __('HeadSpace', 'headspace'), array( &$headspace2, 'metabox' ), 'myposttype', 'normal', 'high' );
	}
 
}
add_action( 'wp_print_scripts', 'myposttype_headpspace_add_custom_box' );

Google Analytics for WordPress plugin not tracking WP e-Commerce transactions?

Wednesday, 11th August 2010

I recently tried out Joost de Valk’s Google Analytics for WordPress (version 4) and was happy to see it supported ecommerce tracking for WP e-Commerce.

I had the latest version of WP e-Commerce installed, version 3.7.6.7, and configured the analytics plugin to track transactions but for some reason my ecommerce purchases were not being tracked by Google Analytics.

I did a bit of digging around and discovered the Analytics plugin was looking for the global variable $cart_log_id from which it could get the transaction details, but this variable did not seem to exist (it did seem to be in pre 3.7.6.x versions of WP e-Commerce though).

I have submitted a patch for this for the forthcoming WP e-Commerce version 3.8 (which is currently in beta and looking great, by the way).

In the meantime, if you’re having this problem here’s how you can fix it…

Read the rest of this entry »


WordPress.org Goshdarnit!

Tuesday, 20th July 2010

Was just browsing WordPress.org and got this server error message.

Matt, if there’s a WordPress problem is it always your fault?
Made me chuckle ;)