background preloader

Menus

Facebook Twitter

Thematic Pages Menu & wp_page_menu filter « ThemeShaper Forums. Hi, First; the initial thanks - Thematic is fantastic, and I use it A LOT at work to help with building a decent basic skeleton for a site and a theme.

Thematic Pages Menu & wp_page_menu filter « ThemeShaper Forums

Thanks HUGELY for the work put in on it. Now; the issue. In the course of building a Page Menu widget I ran into an annoyance that might not yet have occured to the Thematic writers. So I'm putting it forward for consideration. Basically its a pain to get wp_page_menu working for you if you're writing a plugin that has to live alongside the Thematic page menu. By filtering wp_page_menu instead of capturing its output and then altering it in the one place really intended, Themtaic renders the core function useless to any other plugin or widget running on the site.

There's a quiet assumption in the use of that filter that only one page menu call would ever be made on a page; and we know what assumption is the mother of... Basically any call to wp_page_menu gets the sf-menu class added to it; which makes that menu render horizontally. Use: Delicious Recipes for WordPress Page Menus and Page Listings. There are so many awesome ways to display your WordPress pages.

Delicious Recipes for WordPress Page Menus and Page Listings

Out of the box, WordPress provides two different template tags for displaying lists of your site’s pages. The first, most-commonly used tag is wp_list_pages(), and the second, lesser-known tag is wp_page_menu(). First we’ll explore the highly flexible wp_list_pages() template tag, and then we’ll dig into the new wp_page_menu() tag. Along the way, we’ll check out some delicious recipes, tips and tricks for creating the perfect WordPress Page Menu. Digging into the wp_list_pages() template tag Almost everyone is familiar with the wp_list_pages() template tag, and it has served us well since WordPress version 1.5. And then you can customize that in many ways using the fine menu of arguments provided at its Codex Reference Page. Extreme Sorting Power You can sort your pages by the descriptor of any field in the wp_post table of the WordPress database. Include and Exclude Anything Control the Depth of Pages Use with Custom Fields <?

New page menu function in WordPress 2.7. There are several new features for theme authors in WordPress 2.7 that should be covered, but I believe one that might be useful is the new wp_page_menu() function.

New page menu function in WordPress 2.7

It’s nothing special, but it does take a lot of the work out of coding that we do over and over in every theme we create when using the wp_list_pages() function. Here’s an example of how to use it: This automatically adds a div with the ID of page-nav around an unordered list, which also includes a link back to the home page. The output basically looks like this: <div id="page-nav"><ul><li class="current_page_item"><a href="#">Home</a></li><li class="page_item page-item-1"><a href="#" title="Example">Example</a></li><li class="page_item page-item-2"><a href="#" title="Example">Example</a></li><li class="page_item page-item-3"><a href="#" title="Example">Example</a></li></ul></div> It just wraps up some of that code that we normally have to write.

Change output from child theme or plugin <? Backward compatibility.