Use the WordPress 2.7 way to list your pages
November 21, 2008 · Print This Article
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'); ?>
Comments
Got something to say?
You must be logged in to post a comment.