42 Responses

  1. Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 04/18
  2. Adriaan
    Adriaan Published |


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

  3. Justin
    Justin Published |

    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
    Adriaan Published |

    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
    Justin Published |

    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
  7. New Wordpress theme & plugin releases. Something ‘fresh’ | RandLIFE
  8. Blogtology » Blog Archive » WP Plugs April 21, 2007
  9. WeblogToolsCollection Español » Blog Archive » Plugins de WordPress publicados 18/4
  10. Subpages?
    Subpages? Published |

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


  11. Justin
    Justin Published |

    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:

    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 **********************
    	} // END FOREACH

    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
  13. Interesting websites for SEO, Web Marketing and everday work from Sante - November 10th
  14. charliegolf
    charliegolf Published |

    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
    Matt Published |

    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
    Matt Published |

    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
    Matt Published |

    Here is what I have now:

    Deleted by admin. Please properly post code.

  18. Matt
    Matt Published |

    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
    mgmt Published |

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

  20. Justin Tadlock
    Justin Tadlock Published |

    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.

    // 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"))
    	// End sub-subpages
    	// Ends list of subpages with descriptions
    	} // End foreach
    } // End if statement

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

    global $wpdb, $childID, $post;

    You might want to check out WordPress Pages.

  21. Mosey
    Mosey Published |

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

  22. Mosey
    Mosey Published |

    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
    Iva Published |

    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
    Iva Published |

    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
    Iva Published |

    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
    Iva Published |

    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):


  27. Iva
    Iva Published |

    Thanks, will do.:)

  28. charliegolf
    charliegolf Published |

    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
  30. WordPress High | Emerging Technologies Consulting
  31. hernan
    hernan Published |

    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.
    (Congratulations and thanks from Argentina)

  32. Patrick  Iverson
    Patrick Iverson Published |

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

  33. William Lindley
    William Lindley Published |

    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).


  34. eB
    eB Published |

    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
    Rebecca Published |

    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.

  36. tango
    tango Published |

    Is this case possible ?

    Page title
    Image (external image link)
    Excerpt(WP’s excerpt)

    *title, image order is O.K if any order.
    * currently, subpage is O.k(in Text)

    How call & insert external image link with excerpt sub list, could you give good idea?

  37. tango
    tango Published |

    also, when call & insert external image, how resize images?

    Tks in advance

  38. Cian McCoy
    Cian McCoy Published |

    Perfect, exactly what I was looking for

  39. Rob
    Rob Published |

    Exactly what I needed, a 6 year old plugin 🙂
    Still works on WP 3.5 °_°
    Thanks a bunch!

  40. Martina
    Martina Published |

    is it just me? Somehow the subpages stopped showing up 🙁 it worked all the time, but not anymore.

Comments are closed.