List Nested Pages
Sorry, but there are better ways to do this now. This project has been deprecated and is no longer in development. This page will be kept online for archival purposes and in case anyone is still interested in the project despite being no longer maintained.
The PixoPoint List Nested Pages plugin is a very simple plugin for WordPress which allows you to display a list of your WordPress pages but only include the pages you specify along with all of their nested pages. This is unfortunately not possible with the standard wp_list_pages() function which is provided with WordPress core.
Download PixoPoint List Nested Pages plugin v0.1
How to use it
To use this plugin, simply install and activate the plugin, then declare the pixopoint_list_nestedpages() with a comma delimited list of ID’s you want to include wherever in your theme that you want to display the list.
Example: To include the pages with ID’s of 61, 171, 73, 75 and 77, you would add
the following to your theme where you require the lists (check for the function
first in case so that an error won’t be triggered if you uninstall the plugin.
<?php if ( function_exists( 'pixopoint_list_nestedpages' ) pixopoint_list_nestedpages( '61 ,171 ,73 ,75 ,77 ' ); ?> ?>
Remember that this only creates a series of listed links. For it to behave as a menu you would need to wrap it in a UL tag like so:
<ul id="suckerfishnav" class="sf-menu"> <?php if ( function_exists( 'pixopoint_list_nestedpages' ) pixopoint_list_nestedpages( '61 ,171 ,73 ,75 ,77 ' ); ?> ?> </ul>
The function
For those of you who would like to incorporate this directly into their theme rather than using the plugin, you can simply place the following function into your functions.php file to make use of it.
function pixopoint_list_nestedpages( $include ) { $include = explode( ',', $include ); // Splits list of included ID's up // Generating the list itself foreach ( $include as $page_id ) { $page_id = intval( $page_id ); // Converting from string to integer $page = wp_list_pages( "echo=0&title_li=&include=$page_id" ); // Grabbing the designated top level menu item $submenu = wp_list_pages( "echo=0&title_li=&child_of=$page_id&depth=1" ); // Grabbing the sub-menu if ( $submenu ) $page = str_replace( '</li>', "<ul>$submenu</ul></li>", $page ); // Nesting the sub-menu inside the top level menu item echo $page; // Displaying the HTML on the page } }
Support
We will not be providing any free support for this plugin. If you require assistance with it, please sign up for Premium Support and we will be happy to assist you in using it or custom building a new version designed to meet your requirements.
License
This plugin is released under the GPL v2 license.