Wordpress Custom Menu Plugin

This is a very simple plugin that I wrote to manage navigation menus from the admin panel in WordPress instead of having to code the template each time a menu or a menu item was added, removed or changed.

Download Wordpress Custom Menu Plugin

Menu items are added in the Tools->Custom Menu section of WordPress Admin as displayed below:

Club Wordpress Custom Menu Admin

Menu items can be added, edited and deleted here. Use the Visible property to set whether an item is displayed.

To display the Custom Menu in a WordPress theme, add the following code to your template file where you want the menu to be displayed:

<?php custommenu_output(); ?>

For the menu items displayed in the image above, the following HTML will be output in the theme:

<ul>
    <li><a href=’/’ title=’Home’>Home</a></li>
    <li><a href=’/articles/’ title=’Articles’>Articles</a></li>
    <li><a href=’http://wordpress.org/’ title=’Wordpress’>Wordpress</a></li>
    <li><a href=’/sitemap/’ title=’Sitemap’>Sitemap</a></li>
    <li><a href=’/contact/’ title=’Contact’>Contact</a></li>
    <li><a href=’/about/’ title=’About’>About</a></li>
</ul>

The menu is output as an unordered HTML list.

Download Wordpress Custom Menu Plugin

All you need to do then is make sure the HTML is styled properly to display the menu correctly. I may do a tutorial on how to do this if there is enough interest, so check out my RSS Feed to keep updated :)

Please let me know what you think of the plugin and what improvements could be made to it.

This entry was posted on Tuesday, October 20th, 2009 at 1:39 pm and is filed under Plugins. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

6 Responses to “Wordpress Custom Menu Plugin”

  1. Quincy says:

    I would add the ability to reorder links

  2. admin says:

    @Quincy – Good idea. I’ll put that in the next release.

  3. Julian says:

    Hey… I just tried your plugin but seems it don’t work with a clean installation.

    line 238: $yahoo = new yahoo;

    What is that?

    tx.

  4. admin says:

    @Julian – Thanks for pointing that out… I uploaded the wrong version. I have uploaded the working version now.

  5. jeremyclarke says:

    Looking at this I just realized you could totally just use the existing links/blogroll interface in WP and create a ‘menu’ category, then display the links from that category in the header of your site. Sorry to make your plugin less valuable, but thanks for the inspiration!

  6. Ricky says:

    This plugin is great! It would be awesome if we can add secondary or tertiary menus… good job! ;-)

Leave a Reply