![]() Instead of listing every subpage on all of your site’s web pages, you can dynamically display subpages only when the visitor is viewing the parent page. Here is a way to simplify your sidebars and overall page designs. So now, before digging into the juicy stuff, here is a “super-delicious” tag recipe equipped with every possible parameter, especially designed for easy customization: &link_after=&authors=0&number=0&offset=0') // contains all parameters as of version 2.8 ?>Īlright, enough of the basics, let’s explore some truly delicious page-listing recipes. There are several more useful parameters for the wp_list_pages() tag, but rather than explaining each one, I will refer you to the Codex for all the boring details. A complete copy/paste recipe for wp_list_pages() Let’s have a look: &link_after=') // wrap anchor text with a span tag ?> ![]() Other new features include the number of pages to display as well the number of pages to pass over when displaying page listings. Namely, we now have the ability to wrap the anchor text of our page listings with any HTML or text. WordPress recently rolled out some new tricks for the wp_list_pages() tag. Great for clients and family members who may not feel comfortable “digging in” ) Even more functionality This parameter also gives you the flexibility of modifying page listings without having to touch any source code. Using meta_key and meta_value parameters, you can tell WordPress to display only those pages that contain specific custom-field key/value pairs. Here is an extremely powerful way to customize your page menus using custom-field values. Note that multiple instances of wp_list_pages() may be used on any given web page. The child_of parameter is a great way to display sub-menus of specific pages, for example for implementation of drop-down menus and so forth. Here are some recipes to customize these default values: There is also the child_of parameter, which defaults to a value of 0 to display all pages and subpages. The first is the depth parameter, which by default displays all subpages, regardless of depth. There are two parameters designed to control the depth of pages displayed by the wp_list_pages() tag. It makes it super-easy to omit an entire branch of pages (the parent page and all descendant pages) from your page listings. The exclude_tree parameter is new as of WordPress version 2.7. ![]() By default, the wp_list_pages displays all pages, but this is easily customized with three useful arguments: WordPress makes it easy to include and exclude any pages to create the perfect page menu. You can see a full list of available descriptors here. To configure custom Page order to display via the menu_order parameter, you simply assign each Page a numerical value in its Write/Edit Admin screen. That first one there is a little wonky, but can prove very helpful for getting your pages to display in any order imaginable. Here are some delicious copy-&-paste recipes for your next project: By default, you get alphabetical by page title, but there are some other great options as well. You can sort your pages by the descriptor of any field in the wp_post table of the WordPress database. Let’s check out some cool things you can do with wp_list_pages(). Using this tag is easy, just add the following code to your sidebar or other choice location: Īnd then you can customize that in many ways using the fine menu of arguments provided at its Codex Reference Page. Along the way, we’ll check out some delicious recipes, tips and tricks for creating the perfect WordPress Page Menu.Īlmost everyone is familiar with the wp_list_pages() template tag, and it has served us well since WordPress version 1.5. First we’ll explore the highly flexible wp_list_pages() template tag, and then we’ll dig into the new wp_page_menu() tag. The first, most-commonly used tag is wp_list_pages(), and the second, lesser-known tag is wp_page_menu(). Out of the box, WordPress provides two different template tags for displaying lists of your site’s pages. ![]() There are so many awesome ways to display your WordPress pages.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |