DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Are you exited by the upcomming release of WordPress 2.7? I am. Wordpress 2.7 will contain a bunch of new functions, as for exemple the wp_page_menu() function. Here’s how to use this new function to create stunning page menus!

Prior to WordPress 2.7, we had to use the wp_list_pages() function to get an unordered list of our pages. The main problem was probably that this function can’t handle a link back to your homepage. We had to ad this link manually. This is done without any manual editing with the new wp_page_menu() function: Just add the show_home=Home parameter.

Also, another useful option is the menu_class parameter: It allow you to wrap the html unordered list with a <div> element.

Here’s an exemple to illustrate it:

<?php wp_page_menu('show_home=Home&menu_class=page-nav'); ?>

Thanks to Justin Tadlock for this!

Leave a Comment

Your email address will not be published. Required fields are marked *