Sections

  • Search Chrome Cow

Design a Day

ShowChildPages

Overview

ShowChildPages is a WordPress plugin that adds a post tag that collates all child pages of a current pages into a single page. For flattening large page hierarchies for export.

It does not generate a list of all the titles of the child pages. It appends all of the content of the child pages to the tagged page.

It was developed from the plugins List Subpages by Rob Miller and Get-A-Post by Kaf Oseo. Thanks to both of these folks for their great work.

This plugin has only been tested under WordPress 2.0.+

So What Does it Do, Exactly?

Let’s say you have a series of nested pages:

  • My Parent Page (ID 42)
    • Child Page One
      • Sub Child One
      • Sub Child Two
    • Child Page One
      • Sub Child One
      • Etc.

Now let’s say you want to put all those pages into a Word document. You could navigate to every page, copy the contents, paste it into Word, and repeat the proccess until you get bored.

ShowChildPage gives you two options.

1. You can place the

<!--showchild-->

tag in ‘My Parent Page’

Now ‘My Parent Page’ also contains the content of all of its child pages

2. You can create a new, blank page, ‘Some New Page’

Place these tags:

<!––showchild––>
<!––Page42––>

in that page.

Now ‘Some New Page’ displays ‘My Parent Page’ and all of the content of its children.

Installation

Unzip ShowChildPage.php and place it in your /wp-content/plugins folder, and activate it from the plugins administration page.

That’s it!

How to Use ShowChild Page

Include the following tag:

<!––showchild––>

In the source code for any parent page in a heirarchy. When the page is displayed, it will show the content of all the child pages of that parent page.

You can show the child heirarchy of a different parent page by including the optional tag:

<!––showchild––>
<!––Page##––>

Where ## is the number of the parent page of which you want to show the heirarchy.

If you are using a WYSIWYG editor, besure to insert these tags with the HTML or Source options. The tags are HTML comments, and should be invisible if added correctly. If you see <!––showchild––> on the page, you need to go back and place it in the source code.

Hacks

Page Depth/Order:

The parent/child heirarchy is generated by the standard ‘wp_list_pages’ command. Edit this line (135):

$junk .= wp_list_pages("child_of=$parent_id&depth=$depth&
sort_column=menu_order &echo=".(!$return)."&title_li=0");

To tweak how deep and in what order the child pages get sorted.

Check out the parameters at the WordPress wp_list_pages page to learn what can be done with the formatting.



Share This Post

del.icio.us:WordPress Plugins digg:WordPress Plugins wists:WordPress Plugins magnolia:WordPress Plugins segnalo:WordPress Plugins Submit to Slashdot Submit to BoingBoing Submit to Make


8 Responses to “WordPress Plugins”

  1. Strafverteidiger München Says:


    Thanks for the download. Great site.

  2. Sean Hyde-Moyer Says:


    Sorry about that. Bitrot, I guess. The link is back on line.

  3. Yoel Natan Says:


    The download link seems to be broken. I’m getting a 404.

  4. 3stripe Says:


    Last night a plugin saved my life

    And it was this one :) :) :)

  5. 3stripe Says:


    Last night a plugin saved my life.

    And it was this one :)

  6. Sean Hyde-Moyer Says:


    If anyone is having trouble getting this to work, make sure your tags are in this format:

    <!––showchild––>

    In my first pass at documentation, I didn’t notice that WordPress had thoughtfully replaced my double-dashes with a single long-dash.

    Uh…thanks, WordPress?

  7. Sean Hyde-Moyer Says:


    Hi Arun,

    First, one very important correction: ShowChildPages does not generate a list of all the child pages, it appends all of the contents of those child pages to the tagged page.

    This can make for a very large page…};^)

    The idea is that you can import that single page-of-pages easily into Word or Open Office, whatever you like.

    So, I would not suggest putting this in your sidebar.

    Having said that, I’m pretty sure this would work almost anywhere, in the sidebar, in a template, etc.

    Putting it in a page template would be…odd. If you used the plain vanilla tag, the template page would display the contents of any pages subsequently parented to it. If you used the Pages tag, that template would always show the same hierarchy of child pages.

    But hey, I just write ‘em. It’s up to you to figure out how you want to use ‘em…};^)

    By the way, if you are looking for a plugin that just lists the names of all the child pages, follow the links for Rob Miller and Kaf Oseo at the top of the page.

  8. Arun Kale Says:


    Hey, this seems like a great plugin.. I have a question, though. Does the [!–showchild–] tag necessarily have to be in the content of the page/in the loop?

    To be more specific, can I use the [!–showchild–] tag outside of the loop in my Page template, say to show a list of child pages in my sidebar or pretty much anywhere outside of the main content.

    Thanks for your time, any help would be greatly appreciated. And again, this is a great plugin, keep up the good work!

Leave a Reply

Comment Preview




All comments are subject to the Rules.