Excellent hack for K2 WordPress theme

One of the things I continue to find a bit tricky with WordPress and the customized K2 theme I have on this blog is tweaking the sidebar to include or exclude elements on certain pages.

Until now, I’ve been digging into the code in the sidebar PHP file and, through trial and error (and mostly luck), have ended up with results I’ve more or less been happy with. No dreaded parse error messages after my tweaking nor major display disasters.

All this has been fine for what displays on this blog’s home page. Where I’ve really run into difficulties is getting things to display or not display in the sidebar on other pages such as individual posts, archive pages, category pages, etc. For instance, I’ve never been able to get the RSS subscription options to display on any page other than the home page. This is all to do with the conditional statements in the PHP code where I’ve scratched my head over code like this –

<?php /* If this is a category archive */ } elseif (is_category()) { ?><?php printf( __(‘You are currently browsing the %1$s weblog archives for the \’%2$s\’ category.’), ‘<a href=”‘ . get_settings(‘siteurl’) .'”>’ . get_bloginfo(‘name’) . ‘</a>’, single_cat_title(”, false) ) ?>

But no more!

I’ve just installed a very nifty hack for K2 called Sidebar Modules written by Ben Sherratt. As described by Ben:

A hack for K2 to allow you to edit the contents of your sidebar. Drag and drop the modules, add your own custom content, decide what to display where, and other general funky stuff.

Funky indeed. It works a treat. It makes it so simple and easy to do exactly what you want to do, shielding you almost completely from any code editing. Reminds me of the ease of use with TypePad Typelists.

If you use K2 on your WordPress 2.x blog, this hack is indispensable. Ben, thanks for developing it.

Speaking of WordPress, version 2.0.2 has just been released. This is described as a security fix. Looks like quite a few bug fixes as well. I’m currently running 2.0.1 and do plan to upgrade. Soon.

[Edit] I’ve encountered a little problem so I’ve disabled Sidebar Modules for the moment. Help requested in the K2 Forum.

[Technorati: , ]

Print Friendly, PDF & Email