Filter Top Menu Plugin

During my escapades with WordPress and various templates we’ve put together and worked with, I’ve discovered an interesting problem with a number of the DHTML menus that are generated from the WordPress categories or pages (using wp_list_categories or wp_list_pages).

If you have a hierarchical page system (which this blog does not, but www.kabarty.com.au does – and performs a nice demo site for my plugin!) then it may very well be that the item that forms the top menu item (in the case of Kabarty’s site, almost all of the top menu items) is not actually a page you want people to be able to visit – but WordPress forces all Categories or Pages to be clickable links when they’re returned through wp_list_categories or wp_list_pages.

Take for example the following menu structure;

HomeMarketing & DesignCompany
 Web Site DesignAbout Us
 E-CommerceTestimonials

It’s highly likely that the menu items Marketing & Design and Company do not need to have pages of their own, but because the DHTML produces a drop down menu, they still need to be clickable links, so that the menu will drop down when you hover over the top.

This is where my plugin comes in. It will alter the destination urls for the top menu items (ie, Marketing & Design and Company) so that instead of going to a page they actually just go to ‘#’ – which most browsers will simply ignore when you click – but still allows the browser to display the drop down menu when you hover over the item.

To install the plugin, first determine if you’re working with categories or pages, and then download the appropriate plugin below. Install it into your WordPress installation in the normal way. Go to your Administration for WordPress, choose Filter Top Menu under the Settings and enter the page/category numbers of the pages/categories that you wish to not have actual pages. It’s that simple!

Filter Top Menu

If you have any questions, please just ask!

Upgrade to WordPress 2.7.1

I thought I’d just drop a note on here to say that upgrading from WordPress 2.5 to WordPress 2.7.1 was an absolute breeze.

I followed the instructions at http://codex.wordpress.org/Upgrading_WordPress and to be honest it could not have been easier. I moved the original directory and unzipped the downloaded file, then copied across my theme.

To be fair I had no plugins installed previously, so that may have made it a little easier. But I have some plugins now 🙂

WordPress permalink nextpage doesn’t work

I’ve been struggling with an aspect of WordPress that should ‘just work’ but didn’t. That is, if you have decided to restrict the number of pages/posts shown on a page, WordPress automatically generates a ‘next page’ and ‘previous page’ button.

This works fine if you have the standard ‘ugly permalinks’ set up, but if you use custom permalinks it breaks.

The problem is with the .htaccess code that WordPress generates – at least if you’re using it on a server that runs PHP as a CGI. To fix it, I simply edited the .htaccess and instead of the RewriteRule looking thus;

RewriteRule . /index.php [L]

Make it

RewriteRule (.*) /index.php/$1 [L]

This has the effect of passing the PATH_INFO data through to index.php which was stripped by the previous rule. Now WordPress will find your pages properly again and all will work 🙂

This fixes the problem of permalink nextpage giving a 404 error page. The existing WordPress articles probably will work for you if you’re just seeing the ‘no posts’ error.