Collapsing Pages

Please deactivate before upgrading, then re-activate the plugin.

The Collapsing Pages plugin creates a list of all pages and sub-pages, which can be expanded and collapsed dynamically, as you can see in the sidebar on this page. The main function is as a widget, but there is also an option to use it as a drop-down horizontal menu for basic page navigation, if you are using wordpress as a cms, as in the screenshot below:

Collapsing Pages screenshot

Note that the dropdown functionality has been removed in version 0.3, and will be made into a separate plugin in the near future.

The plugin is hosted on the official wordpress repository at:

If you have any questions, bug reports, or feature requests, please go to the forum

Your appreciation

If you really like my plugins, please give them a nice ranking in the wordpress plugin repository (links above), or you can send me a donation via paypal below:

69 Replies to “Collapsing Pages”

  1. Hi Rob,

    I’ve got one more suggestion regarding i18n: currently, it’s not possible to exclude pages with multilanguage titles as used by qtranslate (trivially). The wordpress core Pages widget is less elegant but more flexible when it comes to excluding as it requires page IDs (not names) for its exclusion option. So maybe you’d want to switch to using page IDs, too. I think that would also enable you to use WP’s get_pages function instead of the rather complicated SQL you’re doing right now in collapsPageList.php, no? It seems to support pretty much all of the required query parameters, though you’d probably lose the ability to query for posts to include in the collapsing pages menu.


  2. Bernhard. Those are some good suggestions. Thanks. One follow-up on qtranslate and i18n. Shouldn’t the slugs be the same, regardless of language? Or are there actually 2 urls pointing to the same id, like

    As far as the get_pages function goes, it is probably doing some complicated query itself. But it is a good idea to use the API when possible. I will have to investigate further to see if it has all the options that the plugin has.


  3. Rob,

    you’re right about slugs, they’re the same. I was mistakenly trying to use the title instead of the slug.

    And one more note on API use: could it be that it’s actually possible to just (ab)use the plain wordpress Pages for widget by filtering the wp_list_pages() function? The wordpress widget doesn’t do much more than call that function; same for wp_list_categories() etc. Filtering those functions might make the respective collapsing widgets obsolete, which in turn could pave the way for a collapsing-*-plugin merge with just a single options page where you can configure what widgets should be displayed in a collapsible fashion, ie what wp_list_*() functions to filter… The main advantage would probably be code redundancy reduction.


  4. Widget title translation:

    --- collapsPageWidget.php 2009-01-21 20:37:24.000000000 +0100
    +++ collapsPageWidget_modified.php 2009-02-04 22:14:06.000000000 +0100
    @@ -13,7 +13,7 @@

    $title = ($options[$number]['title'] != "") ? $options[$number]['title'] : "";

    - echo $before_widget . $before_title . $title . $after_title;
    + echo $before_widget . $before_title . __($title) . $after_title;
    if( function_exists('collapsPage') ) {
    } else {

  5. Bernhard,

    Thanks for all your comments and suggestions. At this point, I am not in the mood for a complete rewrite. I just don’t have time for it. It might be better in the long run. The tricky thing is that the wp_list* functions return html, so I would end up having to add a bunch of html with javascript, which is ok, but I would rather do it with php. The other thing is that different people have requested different options for the different plugins. I would still need to have a way to show different options for each use.

    I will add in your patch to the title.


  6. Hi there :) This is a great plugin however I am having some issues. I am using a snazzy theme called Ikarus and unfortunately when I add this plugin, it kills my footer. The text still shows in the footer but it breaks all the images. I’m puzzled as to why this is, maybe you can shed some light on it as I would really like to use this plugin.
    At first, I didn’t realise it was the plugin that affected my footer until I viewed the page source and the collapsing pages code seemed to be plonked in the middle of the footer code. After disabling it, my footer worked again.

    Also, top level pages show but when I click them, nothing happens at all. It animates to show that I’ve clicked to expand/collapse but nothing happens. At some point, I managed something but I’m not too sure what I did. I think it worked when I went on to that specific parent page – then all the sub-pages showed.

    Anyway, thanks for the plugin, I just hope I can get to use it again :)

  7. Leanne,

    I will check into the Ikarus theme. The plugin does load some javascript in the footer, because it speeds up page load time to put javascript at the bottom of the page. Could you send me a link to your site?


  8. Hi Rob, thank you :) I’ve added my website in the form now.
    It seems to be an issue with the very latest version of the plugin as immediately after upgrading the plugin this issue arose.

  9. @Leanne,

    Turn off the “animate collapsing and expanding” option. It is a conflict with another javascript library that your theme loads.

Comments are closed.