wp_page_menu in WordPress 2.7
September 18th, 2008 by Michael • WordPress News • 3 Comments
New in WordPress 2.7 is the template tag wp_page_menu(). This function creates a page navigation. As parameter you can add a menu "Home" with show_home , or whatever you like.
wp_page_menu('show_home=Home');
wp_page_menu() is a wrap for wp_list_pages(), which additionally add a link to the homepage and assign the class current_page_item, if the starting page is active. For users who doesn't know a lot about PHP, this will be a great help.
From the aspect of a theme developer, it might be a problem using CSS Frameworks, which uses their own classes and structure.
Info
- Published in WordPress News
- Tags: template_tag, Theme, WordPress
- Comment feed | Trackback URL
- read: 7115 | today: 2
- leave a Comment



Cool! I was looking for something like this.
Hi, this function seems really useful for outputting a standard nested ul li ul...etc for creating global navigation. However, is it possible to inject custom markup or would I have to code my function tp generate the navigation with the markup I need?
cheers
Ollie: You can wrap the ul with a div like
wp_page_menu('menu_class=my_own_class&show_home=Home&depth=1')where my_own_class is the class for the div.
Thats all.