Amplified Projects

Subpages Wordpress Widget

=== Plugin Name ===
Contributors: Amanda Chappell
Donate link: Donate
Tags: subpages
Requires at least: 2.7.1
Tested up to: 2.9.1
Stable tag: 1.3

A widget to display the subpages of the current page. You can now choose the depth of children to display up to depth 10.

== Description ==

A widget to display the subpages of the current page.

=Version 1.1 Changes=
You can now choose the depth of children to display up to depth 10.
Choosing 0 will show all depths
Choosing 1 will show just the top pages
Choosing 2 and so on will show pages just to the chosen depth.
=Version 1.2 Changes= This makes sure that if you have no subpages, not space is left for the widget on that page.
=Version 1.3 Changes= Put in code so that at the bottom level, other subpages of the current page’s parent are shown.

== Installation ==

1. Upload ’subpages.php’ to the `/wp-content/plugins/` directory
2. Activate the plugin through the ‘Plugins’ menu in WordPress

== Frequently Asked Questions ==

= Will there be more updates? =
Yes, but I’m not sure how soon.

== Screenshots ==
= No screenshots yet =

3,646 views

18 Comments for this entry

  • baron

    Works great, thank you

  • Andrea

    Hi Amanda,

    I’ve installed the plugin in the plugin folder, activated it and set up two subpages, under service. The subpage plugin isn’t working (yet), so both pages are in standard “child” form.

    Wordpress version 2.7.1
    Wordpress design Thesis, 1.5, with the options set that allow for drop down menu plugins.
    Web site (still in development, obviously):
    http://www.tothepointwriting.net/wp/

    Maybe what’s wrong is that I haven’t set the depth, but I cannot figure out *where* to set that.

    Any ideas?

    Thanks!!

    Andrea

    • Amanda

      Have you put the widget in your sidebar? This would be under Appearance -> Widgets. Subpages should be listed there and you click the add Link to put the Widget in your Sidebar. Then you must click Save Changes. This is also where you set the depth if need be. You can also change the display title of the widget in this section.

  • Wayne

    Thanks for a very handy plugin, Amanda. I had a small problem with it and thought you would appreciate knowing how I solved it.

    I don’t have subpages on all pages of my site. When there were no subpages, ie would still insert extra space where the widget was sitting – this was very annoying as you can imagine.

    I finally realized that by moving ‘echo $before_widget;’ and ‘echo $after_widget;’ inside the ‘if($children)’ statement, it eliminated any footprint of the widget when it wasn’t providing any content. This solved the problem.

    Best,
    Wayne

  • Wayne

    Sweet! Talk about service! Thank you so much. Now I don’t have to worry about future upgrades!!

  • Sandip Saini

    The content you have permitted for is pretty concerning and useful. Thanks for info!

  • Chris

    Hi Amanda,

    GREAT Plugin! One question I had though, is it possible to keep the subpages showing, even if a user is ON the subpage. For example, if my parent page is “Trees” the subpages show in the navigation bar when a user is on that page, but dissapear once they click to “Oak Trees”. It’d be great to have an option to have the subpages still show even on a child page, so if a user is on the “Oak Trees” subpage, they could quickly click over to the “Pine Trees” subpage.

    Again, thanks for a GREAT plugin and I appreciate any help you can provide!

    • Roger Goode

      I was interested in the same functionality–Keeping the subpage menu in the sidebar so long as you are *within* the section. On parent page as well as child/sibling pages.

      I was also wondering if there is a way that the widget title can incorporate the Parent Sections name as part of the title? I have a couple of sections that have subpages, and it would be nice to be able to specify for users that the current subpages belong to the named section.

      Is the some sort of shortcode or something that can be placed as part of the widget title? (like Widget Title: “[parent_title] SubPages”) This may be a code I can place myself. I just haven’t discovered what to use yet.

  • Amanda

    I’ll look into this issue, I think it might be as simple as showing the subpages of the parent instead of the subpages of the current page.

  • Heidi

    I did a minor change to the plugin to make it behave like I want. If it is a subpage with no children, it shows other sub-pages of its parent and excludes itself.

    In the widget_SubPages() function I added an else statement to the if. This replaces the } at the end of the if:

    } else {
    $parentId = is_subpage($wp_query->post);
    if ($parentId) {

    echo $before_widget;
    echo $before_title;
    echo $options['title'];
    echo $after_title;
    $output = wp_list_pages (‘echo=0&child_of=’ . $parentId. ‘&title_li=&depth=’.$options['depth'].’&exclude=’.$thePostID);
    echo $output;
    echo $after_widget;
    }

    }

    and also added this function:

    function is_subpage($currentpost) {
    // load details about this page
    if ( is_page() && $currentpost->post_parent ) { // test to see if the page has a parent
    $parentID = $currentpost->post_parent; // the ID of the parent is this
    return $parentID; // return the ID
    } else { // there is no parent so…
    return false; // …the answer to the question is false
    };
    };

    Could be done much cleaner but this is enough to add back in after an update if the next update doesn’t have this feature.

  • Lene

    Hi Amanda.
    Great plug in, used it several times :-)
    But i found a “problem” which happens in the following situation:
    I have a header page with one subpage.
    That subpage have no subpage itself.
    When i go into the subpage, the heading for the widget are still displayed, probably because there is no other subpage on the same level as my subpage. In case there sould be more subpages on the same level, it wouldn’t appear as a problem. If i go to another header page with no subpage, the widget heading is disappearing as it should. Do you think it would be possible to hide the widget header when no subpage is available AND no pages at same level (the feature you introduced in 1.3)
    I have downloaded version 1.1 of your plug in instead to avaoid this, since that doesn not have this problem.

  • jonahpsx

    Hi, i have installed the 1.3 version of the plugin in wordpress 2.9.1, but when i try to activate it, an error says “Plugin cant be activated due to fatal error”. I dont know if i am the only one with this problem.

    Thanks

  • Miles

    It might be helpful to incorporate the information in Amanda’s 4-27-09 reply into the Installation instructions on this page.

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!