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:
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: http://wordpress.org/extend/plugins/collapsing-pages
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:


Ulisses wrote:
Hello, Rob
First I hope you understand what I wrote because I’m using the google translator.
Downloaded plugin CollapsingPages [WordPress 2.5.1] and liked much because I have several pages with sub-pages.
But the code completely changes the look of my sidebar. [my theme is not widgets].
The text is very large, the background is white [my theme is black].
Placed in style.css the tips to change the color of the links. It worked [took to find out which should place before the #].
I made several attempts to try to change the look, but do not understand, PHP, or CSS, I was a failure.
Maybe you can help?
A hug.
Gareth wrote:
Hi
How can I get rid of the triangle and make the parent title the collapse function?
Thanks for your great work.
gilda wrote:
hello, i was desperately looking for a plugin that would allow me to have collapsing archives and tried installing this according to the instructions… but it was quite impossible and had so many errors, i’m not sure what went wrong. :( maybe i need to ask for professional help for this!
Marc Wenzler wrote:
A copy and waste bug from ‘collapsing-pages’:
Initial html:
►
changes to upon first expand/collapse;
►
Sam wrote:
My installation works when I first click to expand a parent page, but at that point no down arrow (or minus sign) appears and it can not be re-collapsed. Is this a bug?
Also, I too would be curious to know if there is a way to make the parent title itself expand and collapse the sub-pages instead of linking to its own page…
Thanks!
David wrote:
Hi,
Issue with collapsing pages plugin. I have installed the plugin successfully on my localhost but when uploading to my live host server the collapsing pages menu is not displaying. Other collapsing plugins, such as collapsing categories work fine, but not collapsing pages.
Help in this regard is much appreciated!!
Thanks.
David.
Silverlotus wrote:
This plugin is exactly what I am looking for, however, I get three errors when I try to include a third level of pages. (eg. Page > Sub Page > Sub Sub Page) The error occurs even when I change the option for displaying pages at a only a higher level.
I will gladly provide you with a copy of the errors (missing arguments and wrong data types).
tim wrote:
Any chance the plugin will be updated for WP 2.6+ soon?
faus wrote:
bug:
Warning: Missing argument 7 for getSubPage(), called in /wp/wp-content/plugins/collapsing-pages/collapsPageList.php on line 59 and defined in /wp/wp-content/plugins/collapsing-pages/collapsPageList.php on line 29
thank you for your help
vina wrote:
i am currently using wordpress 2.6.3
i downloaded the collapsing pages plugin and
the error below is showing if Page>Subpage>subpage is selected.
is there a way to fix this?
please let me know. thank you very much.
==================================================================
Warning: Missing argument 7 for getSubPage(), called in C:\xampp\htdocs\wordpress\wordpress\wp-content\plugins\collapsing-pages\collapsPageList.php on line 59 and defined in C:\xampp\htdocs\wordpress\wordpress\wp-content\plugins\collapsing-pages\collapsPageList.php on line 29
robfelty wrote:
@Vina and @Faus,
Thanks for alerting me. I have fixed it in version 0.2.4
Rob
Jup wrote:
Warning: Missing argument 7 for getSubPage()
Got the same error as “faus” gets. Don’t you know what’s, wrong?
Jup wrote:
Sry, did not saw your last post. Anyway I have instaled the 2.4 version and now getting:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in
robfelty wrote:
@Jup – your last comment seems to have gotten cut off – could you paste in the whole warning?
Rob
Jup wrote:
Sry, there it comes:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/users/username/domain.com/web/wp-content/plugins/collapsing-pages/collapsPageList.php on line 63
Jup wrote:
Any luck to solve my problem?
Robert Felty wrote:
@Jup,
Sorry for the delay. I fixed it in version 0.2.5 a few days ago, and figured you would see that. But I just now realized that wordpress was still listing 0.2.3 as the stable version. That should be fixed now.
Rob
Jup wrote:
It’s working perfectly! Thank you a lot for your time and great help!
Jessie Angel wrote:
How can I add this to my sidebar manually?
robfelty wrote:
@Jessie,
look in the readme.txt file
tf wrote:
hi,
first of all thanks for your plugin and time given to community.
i’ve put my hands on this plugin and was a little sad to see that the plugin didnt autoexpand currentpage.
first i tried to guess how to modify the code to make it detect the current page, then auto-expand parent pages and auto-close others etc.. it was quite complicated, in fact
so i looked into wp_list_pages() and found that it has current_page_item, current_page_ancestor style attributes that the current list_pages() plugin function doesnt have.
here is a replacement for the list_pages function that i think i have to share with you (works only if you need nested menu) :
$expand='►';
$collapse='▼';
if (get_option('collapsPageExpand')==1) {
$expand='+';
$collapse='—';
}
$collapseLink = "$collapse ";
$expandLink = "$expand ";
$out = wp_list_pages(array('echo'=>false,'title_li'=>null));
$out = preg_replace('/(]*current_page_[^>]*><a>]*>[^<]*[^<]*)/', '\1'.$collapseLink.'', $out);
$out = preg_replace('/(]*((?!current_page_)[^>])*><a>]*>[^<]*[^<]*)/', '\1'.$expandLink."", $out);
echo ''.$out.'';
}
it is only regexp (btw ugly regexp quickly coded, if you see a way to improve it it’s cool) but seems to work as before and also adds autoexpand for currentPage ! \o/
i’ve never coded wp plugins before but this works on my in-progress blog, so i dont know if i am missing something or doing something wrong..
hope it helps
tf
robfelty wrote:
@Tf,
Thanks for that code. I will try to incorporate that feature in a future version soon.
Rob
baron wrote:
hi. Thanks for plugin
perfect.
Regards
Baiulus wrote:
Hello,
I have problem with this widget.
I added this to my site but it takes all width of site not only width of sitebar, so it cover my posts.
PS: Sorry for my bad english ;)
robfelty wrote:
@Baiulus – can you give me a link to your site? I can’t do much with it otherwise.
Rob
Baiulus wrote:
Rob, I send you mail with link to my page. I found that this is foult of theme which I,m using and I have to repare it, but I have no idea how ;p
Raphael wrote:
Hi
Thanks for your widget. I am currently using it for a website I didn’t put online yet.
I’m sorry but I have 3 questions. I know, it’s a lot.
1) It works for sidebars but I don’t know how to use it for a header as in your example with the button “about”.
Did you explain somewhere how to use collapsing-pages on a header ?
2) On my website, for the sidebars, I use images for + and -. But sometimes, the browser can’t open the images so it is written “expand” or “collapse” instead of having a + and -. Is there something I can do for it ?
3) Is it possible to configure your widget in order that anytime I would click on a page or on an article, all the sub-pages would collapse?
I ask this because, in my case, I have many pages linked to parent pages. If it could collapse anytime I go somewhere in my website, the sidebar would be clearer, cleaner.
Thank you and sorry for all my questions.
Raphael
Raphael wrote:
Hi Robert
I am really sorry but I have a 4th question.
I tried to exclude 4 pages but it worked only with 2 of them. I checked many times if the spelling of the page title was exactly the same than the spelling I put in exclusion box. But it finally doesn’t work.
Is it possible to exclude page id or menu order ?
Thank you, Merry Christmas
robfelty wrote:
@Raphael,
Sorry for the slow response. I have been busy with family for the holidays.
I will try to answer your questions -
1. Header – I actually removed this functionality in 0.3, and am working on making that a separate plugin, since I didn’t think it was that related. However, if you think it is related, I could try to add it back in. In any case, using it both as a widget, and as a drop down like in your header is not possible at the moment. You can only do one or the other (and to use it in your header, you would have to use a previous version (0.2.3 I think).
2. I am not sure why the images are not showing up. What browser are you using?
3. Many people asked for the exact opposite of this request. That is, people requested that if they expanded the parent page “foo”, that “foo” would be expanded if they navigated to a different page. This is the current functionality. I could make this into an option in the future.
4. Do your pages have any special characters in them? Right now the exclusions work with either the title or the slug.
If you send me a link to your site, I might be able to help more.
Merry Christmas to you too.
Rob
Jup wrote:
Greetz,
I’m back with a problem again. :( Your latest version 0.3 is acting weird in WP 2.7. When I add it into sidebar list and save it your widget dissapear from the list. So it can’t be enabled. Is it some bug or am I doing something wrong?
Version 0.25 was working fine.
Jup
John wrote:
Just a heads-up, I love the plugin, but after this new upgrade, to 2.7, the widget doesn’t show any of my categories in it. I haven’t changed my settings from the previous install, nor have I changed anything about my theme. Any ideas on why my categories wouldn’t show up in your widget, but just fine in the normal Categories widget?
robfelty wrote:
@Jup and John,
Please follow the installation instructions in the readme.txt file. There is a known bug with this plugin and WP 2.7. A workaround is detailed there. Hopefully I will have time to do a real fix soon.
Rob
Tzvi wrote:
I am using WordPress 2.7 and I am having a unique issue. I can get the plugin to show on my pages, but there are no pages listed. I have tried every combination of settings and still nothing. I have examined the source code and it shows up as:
<ul id='collapsPageList'>
</ul> <!-- ending collapsPage -->
</li> </ul>
Any idea what could be wrong. I prefer not to give out the web address here as the site is still under construction, but I am willing to via email. Thank you for your help.
Simon wrote:
Hello there Rob,
Quick query about the adding of ’self’ class to the current page – this only appears to work on top level pages, so that when I navigate to a sub-page, no ’self’ class gets assigned, and the current page is unstylable (and still linked). Is this intentional? Any way round it? Would be fantastic to be able to style the current sub-pages in the same way as top level pages.
Many thanks!
robfelty wrote:
@Simon,
Thanks for pointing that out. I think I had been working on that feature, and then never got it totally figured out. I added a self tag to subpages now too in 0.3.2
Rob
Simon wrote:
Wonderful, thanks a million, Rob. I noticed that the plugin doesn’t play well with Lightbox, by the way, as they both call up different versions of prototype.js (well, the same version, but in different locations). Commenting out the prototype call in the Lightbox seems to do the trick, and although I’m occasionally getting ‘nv is null’ errors in my Firefox error console, they don’t appear to stop stuff from working.
Thanks for all your work.
robfelty wrote:
@Simon,
Wordpress has a function called wp_enqueue_script which ensures that only one copy of a javascript file is loaded, and it checks the version. However, if the lightbox plugin is not using this to load the prototype library, then you will get problems. You might want to ask the author of the lightbox plugin you are using.
Rob
Bernhard Reiter wrote:
Hi,
I’m using collapsing pages 0.3.2 with WP 2.7.
I’ve noticed that when “Animate collapsing and expanding” is selected, my pages just won’t expand – only the plus sign will change to a minus (that way, I can only access my top level pages).
On another note, when I’m browsing a page with subpages, not only the menu entry for the current page is highlighted (=bold), but also its subpages (and, if present, their subpages) are. I think that’s not really desirable – just the current page is enough highlighting.
Other than that, great plugin.
robfelty wrote:
@Bernhard, this is probably a conflict with another javascript library being loaded by another plugin. Collapsing Pages uses scriptaculous, and is loaded correctly using wp_enqueue_script. You might check your other plugins. I did not see the plugin being used on your page. Is this a different site you’re referring to?
Rob
Bernhard Reiter wrote:
Okay, I’ve identified the culprit: it was the slimbox plugin (and yes, this is about a site that hasn’t gone online yet).
On the other issue, I’ve just updated the collapsing pages plugin, but now there’s no bold highlighting at all. Instead, for menus consisting of more than just one nested hierarchy level, the word “foo” is displayed in front of the minus signifying an expanded menu list (I’m using the plain html +/- style) when browsing the corresponding page or any page below that page’s hierarchy level. I’m observing this behavior for any page except for the top hierarchy.
Last but not least, there seem to be some oddities with some themes where the collapsing menu list bullets interfere with the theme ones (ie both are displayed, eg in case of the Brownbound theme). I think this isn’t really desirable, but I’m not sure what would be better as the theme of course does not provide collapse/expand icons. One possible way would be suppressing the theme’s bullets altogether for collapsing page hierarchies.
robfelty wrote:
Bernhard – I removed the debugging info in 0.3.4. To get the bold highlighting, deactivate, reactivate, then click on “restore original style” in the settings panel.
For other styling issues, this can all be addressed with css in the settings panel. Just set list-style-type to none for any <li> that you don’t want to have a bullet. The default css style does this for the default wordpress style. You might need to change #sidebar to something else.
Rob
Scott wrote:
Bernhard, love the plugin… I noticed a few things while trying to use this on a site I’m building for a friend. I don’t think that the “include posts and pages” checkbox in the widget options needs to be there anymore in 0.3.4 since this is only for pages. Also, though the debugging is deprecated, the checkbox option is still there also in the widget options. In the widget options, under the auto-expand option it states “category” instead of “page(s)” – a carryover from it’s relative. Lastly, though I am inserting the correct pageid in both the exclude and autoexpand options, neither works (the pages are neither excluded nor autoexpanded). I think that’s it. Love your work here… been looking for something like this for a long time.
Scott
Scott wrote:
Forgot to mention that I am using WP 2.7
Scott
Rob wrote:
Scott,
Thanks for pointing out the mistake of “category” instead of “parent page”. I will change that. You don’t want to use page ids though. Enter the page title or slug. For some reason people keep trying to use the id, which seems much less user-friendly to me. How can I make this more obvious?
Also, what do you mean that the debug option is deprecated? If you are having trouble, it provides very useful information (both for you and for me if you ask a question).
Rob
Scott wrote:
Rob (sorry I got the name wrong, reading them all mixed up my mind)
Thanks for the reply… it could be my mistake on the deprecation, I assumed that by the post above that says, “I removed the debugging info in 0.3.4″ – as for your question, maybe including “(page slug)” in the option line might help. I assumed it was pageid because I’ve used so many other addons that use it. Your way is much much much better. Again, I can’t convey how much I love this plugin. Thanks!
Scott
Scott wrote:
Wanted to let you know that the exclude page works great with the slug, but autoexpand did not work for me using the Title or the slug. You can see it here
Scott
robfelty wrote:
Scott,
Glad that is working. The cookies can be confusing there. But it is the only way I could think of making them stick for different visitors.
Also, I was referring to a stray “foo” I had left in the code that Bernhard pointed out, not the debugging option. That wasn’t very clear.
I will work on making the exclude and expand options more transparent.
Rob
Bernhard Reiter wrote:
Hi,
I’ve now tried collapsing pages together with the qtranslate internationalization plugin and found that page titles aren’t displayed properly due to lack of l10n functions. I’m attaching what seems to solve the issue:
+++ collapsPageList_modified.php 2009-01-28 14:57:22.000000000 +0100
@@ -92,7 +92,7 @@
}
$link2 = "<a $self href='".get_page_link($page2->id)."' ";
$link2 .= '>';
- $link2 .= $page2->post_title. "</a>";
+ $link2 .= __($page2->post_title) . "</a>";
$subPageLinks.= $link2 ;
if (!in_array($page2->id, $parents)) {
$subPageLinks.="</li>\n";
@@ -227,15 +227,15 @@
$link = "<a $self href='".get_page_link($page->id)."' ";
if ( empty($page->page_description) ) {
if( $showPostCount=='yes') {
- $link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($page->post_title)) . '"';
+ $link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars(__($page->post_title))) . '"';
} else {
- $link .= "title='View all subpages'";
+ $link .= 'title="' . __("View all subpages") . '"';
}
} else {
$link .= 'title="' . wp_specialchars(apply_filters('page_description',$page->page_description,$page)) . '"';
}
$link .= '>';
- $link .= $page->post_title.'</a>';
+ $link .= __($page->post_title) . '</a>';
// TODO not sure why we are checking for this at all TODO
$subPageCount=0;
robfelty wrote:
Bernhard,
Thanks very much for the code. Internationalization has been on my mental todo list for a long time. I will incorporate these changes soon.
Rob
Social Recruiting and an experiment wrote:
[...] additional plugs have been used to add collaborative features including Add to Any, Collapsing Pages, GD Start Rating, and [...]
Bernhard Reiter wrote:
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.
Bernhard
robfelty wrote:
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
blog.robfelty.com/de/hallo
and
blog.robfelty.com/en/hello
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.
Rob
Bernhard Reiter wrote:
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.
Bernhard
Bernhard Reiter wrote:
Widget title translation:
+++ 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') ) {
collapsPage($number);
} else {
robfelty wrote:
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.
Rob
Leanne wrote:
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 :)
Rob wrote:
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?
Rob
Leanne wrote:
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.
Rob wrote:
@Leanne,
Turn off the “animate collapsing and expanding” option. It is a conflict with another javascript library that your theme loads.
Rob wrote:
If you have any comments, questions, feature requests, or bug reports, please go to the forum
robfelty.com :: Blog :: Collapsing Pages Writer River wrote:
[...] WordPress plugin that allows you to expand or collapse page hierarchies. Okay, this is a WordPress plugin that is going to be essential if you import DITA content into WordPress, because you’ll have a huge hierarchy of pages that you’ll want to expand and collapse. This is the plugin that will do it for you. Tom Johnson | February 13, 2009 | permalink Tags: hierarchies, plugins, wordpress [...]
Wordpress sites and plugins I find useful | Jason-Saggers.com wrote:
[...] Collapsing Pages [...]
Wie man statische Seiten von Business-Blogs optimal nutzt: 6 Praxistipps wrote:
[...] Zweite Seiten-Navigation: Bieten Sie zusätzlich zur Headernavigation eine zweite Seitennavigation in der Sidebar an. Wenn Sie eine linke Sidebar haben, ist das der ideale Platz. Es geht bei zwei rechten Sidebars auch rechts außen, wie hier auf meinem Blog. Ich nutze dazu das Plugin Collapsing Pages von Robert Felty. [...]
robfelty com Blog Collapsing Pages | Shed Kits wrote:
[...] robfelty com Blog Collapsing Pages Posted by root 17 hours ago (http://blog.robfelty.com) The plugin is hosted on the official wordpress repository at no down arrow or minus sign appears and it can not be re collapsed jup your last comment seems to have gotten cut off could you paste in the whole warning i 39 m puzzled as to why this is maybe Discuss | Bury | News | robfelty com blog collapsing pages [...]
30 plugins para Wordpress | UnUsuario wrote:
[...] Es un plugin muy simple que usa Javascript para formar un menú por jerarquía de enlaces en tu sidebar. [...]
Author-izer | WordPress Asylum wrote:
[...] Collapsing Pages [...]