Home » Uncategorized

Geeky bits in WordPress 2.9

28 November 2009 No Comment

Geeky bits in WordPress 2.9: “

Thanks to Peter Westwoord’s WordPress Beta Tester plugin, this blog is on the 2.9 development track again, after having been off trunk for a couple of months. That plugin makes it really easy to switch any WordPress install to the development branch, either for the next ‘point’ release (eg. 2.8.6), or the next major version, in this case, 2.9.

Check out Technosailor’s great post on most of the new features for users. Below I’ve gathered a list of things especially relevant for readers of this blog and for developers like myself.

Support for rel=’canonical’

WordPress now has rel='canonical' support built in, there by making my Canonical URL’s for WordPress plugin obsolete, as expected.

Enhancements to wp_query

Although this is more for the geeks, I’d been fighting this one for a while now without realizing it: you could only get $wp_query to either return one type of post (so ‘post’, or ‘page’ or ‘attachment’) or ANY type of post, but not all posts and pages. You can now, IMHO, that’s a major improvement.

Performance updates to options table

It’s a long story, but if you like databases and optimization, this thread on Trac is worth a read. In short: the options table is now more optimized than it was before.

Upgraded TinyMCE

Highlights of that upgrade (here’s the Trac ticket):

  • Empty P tags are not stripped off and would show in the HTML editor as <p> </p>
  • The paste and paste from Word cleanup removes spans and inline styles.

Option to cache wp_remote_get

This might be one of my most favourite simple enhancements. It allows wp_remote_get requests to be cached, very useful, might even be worth adding into a plugin like Frederick’s W3 Total Cache.

category-<slug>.php support

This one will be loved by theme coders all around. You can now make a category-<slug>.php template, where before you always had to make a category-<id>.php template. This one is a lot more intuitive. Incidentally, support for tag-<id>.php templates was added too.

Another major improvement in that area is that you can now make page-<slug>.php templates, so if the slug is sitemap, page-sitemap.php would always be it’s template. Nifty, huh?

Post thumbnails

Though best explained in the the post on Technosailor, you should try adding this to your themes functions.php file:

if ( function_exists( 'add_theme_support' ) )
	add_theme_support( 'post-thumbnails' );

It will add a meta box to your Write screens:

When clicked this will simply bring you to your Media Gallery and add a new link next to insert into post entitled ‘Use as thumbnail’:

Use as thumbnail

The image you select there can then be used with the new functions has_post_image(), get_post_image_id(), the_post_image() and get_the_post_image().

That’s a pretty cool addition for theme developers, together with the media additions, which also allow you to change just the thumbnail, this makes for a pretty decent post thumbnail feature set.

Sidebar descriptions

This new feature allows you to add a description to each sidebar in your theme. If you, like we do very often at OrangeValley, create themes with 10 or more sidebars, that really is a nice feature. It’s very simple too, all you have to do is add a description value to the array you’re using to declare sidebars:

if ( function_exists('register_sidebar') ) {
  register_sidebar(array(
    'name' => 'Complex Sidebar',
    'id' => 'complex',
    'description' => 'Here is some important considerations about Complex Sidebar',
    'before_widget' => <li id='%1$s' class='widget %2$s'>,
    'after_widget' => </li>,
    'before_title' => <h2 class='widgettitle'>,
    'after_title' => </h2>,
  ));
}

And it’ll look like this:

sidebar description

There’s tons more new cool stuff, but this should get you started for now!

Geeky bits in WordPress 2.9 is a post from Joost de Valks Yoast – Tweaking Websites.A good blog needs good hosting, you don’t want your blog to be slow, or, even worse, down, do you? Use WestHost, and you’ll never have issues again!

(Via Yoast» – Yoast – Tweaking Websites.)

Leave your response!

You must be logged in to post a comment.