37 responses to “List Subpages With Descriptions: WordPress Plugin”

  1. Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 04/18

    [...] List Subpages with Description lists a Wordpress Page’s subpages in an unordered list with a description of each one. [...]

  2. Adriaan

    Thanks!

    Just what I needed. Is there a way to disable the list on certain pages though?

  3. Justin

    You don’t have to use the plugin on those pages. In order to list the subpages, you must call the function list_subpages_with_descriptions().

  4. Adriaan

    Right, but i thought i had to put the line in my page template:

    Or is there a way i can include that into the specific page i want? If so, how do I add it?

  5. Justin

    I suppose it might work in the page template. Of course, I wouldn’t know how to control it at this point since the plugin is in a very early stage.

    Here’s how the process works:
    For your subpages (child pages) you need to give it a key named “description.”

    You then give it a value of whatever you want to describe it as.

    For the Parent Page, you just call the function right there in the “Write Page” box.

    You must be able to use PHP in your Wordpress Pages for it to work this way (see requirements).

    Just read the “readme.txt” file or open the “list-subpages-with-descriptions.php” file to see how to call the function.

    This isn’t the greatest plugin right now, but it does what I want it to do. In the future, I’m sure there might be some better admin panel control or something.

  6. List Subpages With Descriptions WordPress Plugin » D’ Technology Weblog: Technology, Software, Hardware, Internet, Web, Google, AdSense, Microsoft, Yahoo, WordPress, Gadgets, Fashion

    [...] more info and download…. [...]

  7. New Wordpress theme & plugin releases. Something ‘fresh’ | RandLIFE

    [...] List Subpages with Description lists a Wordpress Page’s subpages in an unordered list with a description of each one. [...]

  8. Blogtology » Blog Archive » WP Plugs April 21, 2007

    [...] List Subpages with Description lists a Wordpress Page’s subpages in an unordered list with a description of each one. [...]

  9. WeblogToolsCollection Español » Blog Archive » Plugins de WordPress publicados 18/4

    [...] List Subpages with Description lista las subpáginas de una página de Wordpress en una lista sin orden y con una descripción de cada una. [...]

  10. Subpages?

    Any ideia on how to get the list of sub-pages and its sub-sub-pages (children)?

    Thanks

  11. Justin

    Yes, I’m actually doing that on my Writing page (if you want to see it action). However, since it’s not implemented into the plugin yet, you’ll have to do some coding of your own.

    Here’s what mine looks like:

    <?php
    /* LIST SUB-PAGES (/PAGE/PAGE) */
    global $wpdb, $childID;
    $children = $wpdb->get_results("SELECT * from $wpdb->posts WHERE post_type='page' AND post_parent=$post->ID ORDER BY post_title");
    if($children) {
    	foreach($children as $child) {
    	echo '
    	<h3><a href="' . get_permalink($child->ID) . '" title="' . $child->post_title . '">' . $child->post_title . '</a></h3>
    	';  // END ECHO
    	$childID = $child->ID;
    	// BEGIN SUB-SUB-PAGES *******************
    	if (function_exists("list_subpages_with_descriptions")) list_subpages_with_descriptions();
    	// END SUB-SUB-PAGES **********************
    	// ENDS LIST OF SUBPAGES WITH DESCRIPTIONS
    	} // END FOREACH
    } // END IF STATEMENT
    ?>

    It’s basically the same code. The only difference is $child, $children, and $childID. The plugin already has an if statement ready to pull in the $childID.

    What this does is list all of the Page’s sub-pages, then lists every one of the sub-pages’ sub-pages. Of course, it lists their descriptions also. I’m sure I’ll get around to implementing this all into a plugin one day. Since I’m no great PHP programmer, this will take a while.

    One final note: I didn’t give my sub-pages descriptions on my Writing page, but I gave all my sub-sub-pages each a description.

    I hope this helps.

  12. Listado de plugins del dia at Escuela De Blogs

    [...] List Subpages with Description lista las subpáginas de una página de Wordpress en una lista sin orden y con una descripción de cada una. [...]

  13. Interesting websites for SEO, Web Marketing and everday work from Sante - November 10th

    [...] WordPress Plugin – List Subpages With Descriptions – The function of this plugin is to list a Wordpress Page?s subpages in an unordered list with a description of each one. [...]

  14. charliegolf

    dear justin, i tried to use your code for listing pages/subpages and subpages. I doesn’t wordk. Do I have to put the code in the parent page? But do Ihave also call the function or not? I didn’t really undestand very well this code. Tnx. Carletto Genovese

  15. Matt

    I get an error with the code also:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY post_title' at line 1]
    SELECT * from wp_posts WHERE post_type=’page’ AND post_parent= ORDER BY post_title

    I fixed it by changing this line:

    $children = $wpdb->get_results(“SELECT * from $wpdb->posts WHERE post_type=’page’ AND post_parent>0 ORDER BY post_title”);

    It works, but I have no idea if it is correct since this is the first bit of PHP I have looked at, though I do know SQL.

  16. Matt

    Whoops, my first stab at PHP wasn’t correct. Here is something that works better at least. Add this under the third line:

    global $post;

    As I understand it, the $post object has to be declared as global here.

  17. Matt

    Here is what I have now:

    Deleted by admin. Please properly post code.

  18. Matt

    Hmmm… the listing I tried to post above didn’t come out complete. In any case, the only change needed to Justin’s code in comment #11 is to add this below the third line:

    global $post;

  19. mgmt

    how do you post to subpages?
    is there a way to post to subpages like you post to the main page?

  20. Justin Tadlock

    charliegolf
    If you want to list a subpages’ subpages, then just use the code below. Paste it directly into your main parent page. So, the code goes into the first-level page. It displays a link to the second-level page with a list of links and descriptions of the third-level pages.

    <?php
    // List subpages (/page/page)
    global $wpdb, $childID;
    $children = $wpdb->get_results("SELECT * from $wpdb->posts WHERE post_type='page' AND post_parent=246 ORDER BY post_title");
    
    if($children) {
    	foreach($children as $child) {
    	echo '
    	<h3><a href="' . get_permalink($child->ID) . '" title="' . $child->post_title . '">' . $child->post_title . '</a></h3>
    	';  // End echo
    	$childID = $child->ID;
    
    	// Begin sub-subpages
    	if (function_exists("list_subpages_with_descriptions"))
    		list_subpages_with_descriptions();
    	// End sub-subpages
    	// Ends list of subpages with descriptions
    	} // End foreach
    } // End if statement
    ?>

    Matt
    Yeah, that might help out. Just change this line to look like this:

    global $wpdb, $childID, $post;

    mgmt
    You might want to check out WordPress Pages.

  21. Mosey

    Sorry to ask the obvious question, but does the plugin work with 2.5? Thank you!

  22. Mosey

    The plugin download link isn’t working, but thank you for providing the code in the comments. I’ve decided not to use the plugin (hassle of turning of WYSIWYG for Exec-PHP) and instead create a brand new page called page-reviews.php with the code in comment #20. Thank you so much!

  23. Iva

    As usual, you’re being absolutely brilliant!:)
    That might be a not-so-automatic plugin, but some of us like it that way.

    Now, I was wondering two things, since I’m not that great with PHP.

    I have managed to hack the php file to change some of the classes’ names and make the entire blocks clickable and I quite like the way it looks. My site is too confusing and the subnavigation is, at the moment, the ugliest thing in the known world and this will help it a lot once I launch its new version.

    However, I

    If I, let’s say, have a custom field for the subpage thumbnail and I would like to

    I would also to write down the time when the page was last modified ( this: http://codex.wordpress.org/Template_Tags/the_modified_date); where do I implement that in the code? I tried to add php codes for each without , but it resulted in an epic fail.

    This is my modification and let’s say that I intend to put those two in the places I’d bolded:

    Deleted by admin. Please properly format code if posting here.

  24. Iva

    Oh, by the way, I do realise that I could put both inside of the description field and enable php code on each single subpage, but I asume there IS an easier way?

  25. Iva

    Also, is there a way not to display pages alphabetically, but in the specified order?

    Sorry for all this, I’m playing around with the plugin and noticing things along the way.

  26. Iva

    Here’s a link to the code as a text file, as putting it amongst code tags obviously did not work properly (for which I am honestly sorry):

    http://www.squirrelism.net/example.txt

  27. Iva

    Thanks, will do.:)

  28. charliegolf

    Dear Justin, I used your script and now it works perfectly. Just want to know another thing. If i have lot of subpages and I want to list them max 10 subpages per times what can I do to let me show just only 10 subpages and the other 10 or more in another pages. Tnx a lot. Charliegolf

  29. WordPress Watch » Blog Archive » Justin Tadlock - WordPress Plugin and Theme Updates

    [...] Get The Image Cleaner Gallery Widgets Reloaded JavaScript Logic List Subpages [...]

  30. WordPress High | Emerging Technologies Consulting

    [...] way to automatically generate those links. It took a lot of digging, but I found the perfect thing, List Subpages. You can see this in action on our notes page. It was the successful implementation of this feature [...]

  31. hernan

    Aunque no pude aun hacer andar aún la descripción de las sub-páginas me parece que es un muy buen plugin, busqué algo asi por mucho tiempo, muchas gracias.
    Felicitaciones.
    (Congratulations and thanks from Argentina)

  32. Patrick  Iverson

    This is very useful! How can you get the list to display according to the menu order?

  33. William Lindley

    You might also look at my AutoNav plugin, which lets you list child pages in a list, or in a table of thumbnails (each thumbnail being associated with a subpage either through its attachments or through a specified image).

    http://wordpress.org/extend/plugins/autonav/

  34. eB

    Thanks for the plugin, solved days of trying to figure why archive pages weren’t showing child pages very well, and with very minimal installation.

  35. Rebecca

    Hi Justin, Thanks so much for this great plugin. I’m using it in the sidebar of a site. How can I get the current_page highlighting feature to work to indicate that I’m currently on one of the subpages. Thanks so much in advance for any ideas.

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (e.g., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.