Building Your Website, Step-By-Step

RYO Folding Page List & Widget

RYO Folding Page List provides a sidebar widget that displays only top level Pages plus parents
and children of currently displayed Pages. If your website has lots of Pages, this can simplify
your sidebar real estate considerably by displaying only Pages of current interest.

The widget's user interface lets you set the displayed title. It displays your Pages and lets
you designate which Pages should be excluded entirely from the list.

I once used a rather complex function called Fold Page List by the same author as Folding Category List. It took a long path to do the same thing as wp_list_pages(). And it didn’t upgrade well. Here it’s redone with entirely new logic that makes it fast and clean, plus there’s a powerful widget with lots of customization options. And it’s compatible with sorting functions like pageMash.

Requires: WordPress 2.8+

See all of our WordPress Plugins


Page Widget Display - Front Page
1. This is the display of the widget on the Front Page. Top level Pages only are shown, excluding any that were checked in the widget options.

This image reflects our theme, of course. Your website will be styled as defined in your theme.

Page Widget viewing Contact Us Page
2. This is the display of the widget when you select the "Contact Us" Page. The top level categories are still displayed, plus the children of "Contact Us," in this case "Getting Our Email." Children of other top level Pages do not appear.

This image reflects our theme, of course. Your website will be styled as defined in your theme.

Folding Page List Widget Options
3. This is the widget drop down options panel, illustrating how you may choose to exclude listed Pages.


  1. Download and unzip This will unzip to a folder called ryo_folding_page_list.
  2. Upload the ryo_folding_page_list folder to the /wp-content/plugins/ directory.
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. The user interface is in the Appearance, Widgets section of the Dashboard. Customize the display there.

With WordPress 2.8 or later you can use the plugin "Upload" utility to upload and install the plugin.


RYO Folding Page List ver. 2.0.1

Frequently Asked Questions

Can I have more than one instance of the widget?

Yes, the current widget system allows for this.

This would allow you to have a completely separate block in your sidebar for unrelated or special Pages.
It might require customization of each widget as Pages are added. But one easy way to do this would be:

  • Folding Page Widget #1: Exclude Pages D, E, F.
  • Folding Page Widget #2: Include only D, E.
  • Folding Page Widget #1: Include only F.

This lets you put certain pages (D, E, and F) in special places on your website. If you add another page
which you want to appear in Widget #2, you'd have to add it to Widget #2 and Exclude it from Widget #1.

When I select a subpage, will other subpages on the same level be hidden?

That's up to you. In normal operation, subpages on the same level (also called "siblings") will
be hidden. This means one has to go to the parent in order to choose a subpage.

If that's not what you want check the "Include Siblings" checkbox and the other pages with the same parent
will also be displayed.

How do I use this without the widget?

You call ryofpl_folding_list_pages() using the same arguments you would for wp_list_pages().

Consider it to be a direct replacement for that function. (Ultimately, it actually calls the function
after excluding child pages for non-current parents.)

There is one additional argument, optional:

You can set siblings=1 if you want to display "siblings," the other child pages to the
current parent page.



  • Initial release.
  • Complete rewrite to use WP internals available in WP 2.8+. Not compatible before WP 2.8.
  • New logic eliminates most database queries; more efficient, less overhead.
  • Based on original idea by Rob Schumann ( but with entirely new logic.

34 Responses to RYO Folding Page List & Widget

  • hello

    this is an elegant solution to an ongoing problem in wordpress. the plugin works flawlessly. though ther is one little kink. when i select a subpage, all subpages on the same level get hidden. meaning one has to go to the parent and choose a subpage. that’s not allways very handy.
    this could be optional.


  • Raphael, Good idea. Try this one out (.03).

  • Rich
    Wonderful! Thank you very much!
    Best R

  • How to use plugin without widget?

  • Dmitry,

    How to use plugin without widget?

    You call ryofpl_folding_list_pages() using the same arguments you would for wp_list_pages().

    Consider it to be a direct replacement for that function. (Ultimately, it actually calls the function
    after excluding child pages for non-current parents.)

    There is one additional argument, optional:

    You can set siblings=1 if you want to display “siblings,” the other child pages to the
    current parent page. This was the request Raphael made earlier.

    (I’ve updated the documentation Q&A above to reflect this.)

  • Thank`s, I found some comments in php files of plugin, and understood that)

  • Is there something more I can help you with?

  • No, it is all clear! )

  • I have still got a problem :)
    Oh… my English is bad ))))
    I will try to explain:

    I have 3 pages that have many sub pages. This sub pages also have sub pages.

    I want to have 3 sidebar menus, for each kind of page.

    When i use
    where X – id of the page, i cant see whole tree;

    When i use
    It shows me all pages.

    My question – how to make folding list pages only for one page?
    Thank You!

  • The way the widget does it is to exclude pages you don’t want to see by building an exclude list. You check off pages to include, and others are excluded. OR you check off pages to exclude, and those are passed in the exclude list.

    You might try it in a widget and look at the code the widget generates, grab the code from there. Then you could pull the widget.

  • I have a client who has upgraded to beta and has problems. Where is the download for the initial stable release please?

  • Paul, this has not moved out of beta yet.

    What problems is your client experiencing? With which version of WordPress?

  • I need a way to be able to show the entire list of pages without them disappearing when the visitor goes to the 3rd level page, for example, I have:

    main page
    -sub page
    –sub sub page

    I need the list of sub pages to still be listed when a user goes to the sub sub page, I tried loading another instance of the widget that includes all pages, but it still hides all of the pages when you are in the 3rd level page, is there a way around this?

  • Just what I’m looking for except it’s not displaying subpages in the menu when on those subpages, is it compatible with wordpress 3?

  • Yes, it’s compatible with WP3.

    It should show the subpage you are on at the time, and subpages under that page.

    It won’t show all the other subpages; that’s the point of using this… to shorten your page list.

  • Shortening the page lists is exactly what I’m after.

    its strange, its showing all top level pages on homepage which is fine, but not showing subpage I am on at the time when I click through…

    The subpages all appear within the widget area under each parent page, but not on the actual page.

    You can see what I mean here if thats not clear …

    The menu on the left is standard vertical nav which shows subpages under top 3 parent pages.

    The menu on the right is your plugin menu which doesnt show the subpage when on that page

    I may try on another WP site in case there is anything conflicting on this one…

  • Well, Oliver… you’ve provided a good example of the problem, and you’re having one.

    My only guess is that another plugin (or, maybe, your theme) is blocking those subpages.

    This plugin works by detecting the pages that should not appear and adding them to the exclude list. It doesn’t put them into the include list. That makes it possible to have other plugins exclude pages, as in a membership site when a page should appear only if a qualified member is logged in. The membership software can exclude pages, too.

    So you might have something else excluding those pages from display in a way that doesn’t affect the other nav widget.

  • I guess it must be the theme as its the only plugin active. I used the starkers theme and plugged in some basic html/css, so along the way something I’ve done has affected your plugin. Frustrating as it seems the best (if not only) solutuion to this kind of page nav within wordpress.

    Thanks for your help anyway, I shall persevere!

  • Oliver, if you figure something out, let me know what might be affecting it!

  • Hi Rich,

    When using multiple instances of the widget on a site is it possible to style each one differently? If so how would I target each one?

    Thanks for any advice you can give….

  • Oliver,

    I think you’ll find if you examine the html page source that the widget code has been encoded something like <div id="ryofoldingpages-3"

    This would give you styling capabilities.

  • Hi Rich, I managed to figure it out thanks for your help. One last thing though!

    When you have 3 levels of navigation, is it possible to display all levels whilst on bottom level, including siblings of the parent page (level 2)

    eg I would like it to display like below…

    • top1
      -sub1 (currentsection)
      -subsub1 (currentpage)
    • top2
    • top3

    whereas currently I can only get it to display like…

    • top1
      -sub1 (currentsection)
      -subsub1 (currentpage)
    • top2
    • top3

    (loosing sub2 and sub3)

    Hope that makes sense!
    Many thanks for any help you can give.

  • Oliver,

    I think not with the current code. You could, of course, modify it.

  • Thanks for quick reply Rich, guess I’d better learn PHP! dont suppose its a case of adding a quick line of code to “// Show immediate children & siblings” section in the code?

  • Rich, your plugin is awesome and does “almost” everything I want. I’m hoping you can tweak a new version to do this. Let’s say I have 7 top-level pages that I want to show at all times in the sidebar navigation; some have sub-pages. Currently, using your plugin, it works great to show just the top-level pages by default, but if you click on a page with sub-pages, like Page 3, below, it then show the Page 3 sub-pages along with the rest of the top level pages — so far so good:

    Page 1
    Page 2
    Page 3 (current page)
    –sub-page 3.1
    –sub-page 3.2
    –sub-page 3.3
    Page 4
    Page 5
    Page 6
    Page 7

    The problem I’m having is that once you click on a Page 3 sub-page, then all the top-level pages other than Page 3 disappear, like this:

    Page 3
    –sub-page 3.1 (current page)
    –sub-page 3.2
    –sub-page 3.3

    This makes it impossible to navigate directly from say, Sub-page 3.3 to Page 4 (or any other top-level page besides Page 3), forcing the user to click back up the nav tree to once again reveal the navigation to the other top-level pages.

    What would be great is if you could include a “show all top-level pages” checkbox, so that they wouldn’t disappear when a grandchild page is clicked. I have spent many hours trying to code this or looking for plugins, and the closest I’ve been able to get is your plugin. Thanks.

  • YOU ARE BRILLIANT. I have trying to find a solution like this for hours now. Kept trying Fold Page List, but I have a sneaky suspicion that is not working in the latest version of WP. I installed your plugin and voila, works effortlessly and does EXACTLY what I need it to do.

    Excuse the caps, I’m excited :o)

    Cheers Mate.

  • Great plugin, but still only the closest one I’ve yet found to achieve what I want – of course I could modify it to do what I’d like but I have several other programming projects under work so I have no idea when I will find the time…

    However, I thought that I’d describe what I need and what would IMO be the grand page list widget – and maybe you’d like to implement these features yourself?

    1. I want only certain pages to be folded, there could be a list for pages to fold and/or those not to fold. This way I could have certain page->subpage(s)->subpage(s) structure showing all the time, then when you click one on folding list it would show subpage structure under that – of course the above would also affect them… Thus I have certain tree-structure showing at default and depending on which subpages of page on fold list are also on fold list it would possibly show not only subpage but subpages of that too…
      This is absolutely the most important for me – a widget with only top-level showing at default is not a working solution…

    2. There have already been comments about this, but once unfolded a list of subpages should not be unfolded when you unfold siblings of another higher level page from the list.

    …just my thoughts :) I would love to see this done – and maybe if you or nobody else creates one I will do it myself, but it will take time before I’ll even consider taking up another project :)

    Anyway, great work, even if not exactly what I need. Congratulations.

  • Hi,

    Great plugin, serves its purpose.
    However I got 2 issues, hopefully you can help: I have many levels of pages, and I noticed that once I get into a page that is level 4 and lower, the menu stops showing the tree and shows the pages as if they are top level pages. How can I make the plugin show more than 3 levels as a tree?
    Another thing is that I cannt find where I can change the layout of the menu. Once you get into level 3 the font is too small…

    Again, thanks for a great plugin

  • Asaf,

    All the plugin function does is add pages to the exclude list, then calls wp_list_pages().

    The widget is pretty standard as to style, so it’s more a matter of style in your theme.

    Now, if you’ve already excluded parent pages of a target page, that would break the hierarchy. But that has nothing to with the plugin.

  • Hi Rich,
    Thanks for your reply.
    I didn’t understand what you meant by “Now, if you’ve already excluded parent pages of a target page, that would break the hierarchy. But that has nothing to with the plugin.”
    I guess you refered to that number of levels.
    When I set the widget, I excluded some pages, but they don’t belong to the the pages that I want to show.
    Here’s what happens:
    First I see list of parents, when I click on a parent (and all its siblings) this what’s shows:
    parent – sibling1 (2nd level) – sibling1.1 (3rd level) – sibling2.1 (4th level).
    When I click on sibling 2.1 pages of the same level, and of the one before it break from hierarchy, and list as parents of top level.

    My question is how can I “make” the plugin show more than 4 levels in hierarchy?


  • Asaf, try the standard WordPress widget for Pages. See how those levels look there. It should be the same. So the issue is with WP and your theme.

    What the RYO Folding Page List plugin does is add to the exclude list, excluding pages with different parents.

  • I used your advice and noticed that WP widget for pages shows up to 6th level in hierarchy, but the plugin doesn’t.
    Somehow that doesn’t work with the plugin…

  • This is great!

    Couple of questions:
    1. Can I change it so that the drop down list shows (gets unhidden) on hover instead of on click?

    1. Is there a way (or plans) to get it going with jquery for a smoother effect? :-)

    Thanks for a great plug-in.

  • Trevor, (1) You have the source code so you can change it any way you want, and (2) there’s no plans for jquery.

Leave a Reply

Your email address will not be published. Required fields are marked *

Member Center



Your Own Dot-Com Domain
Our Recommended Source for Securing Your Domains. Fast Registration, Direct Support Phone

Reliable Website Hosting
Small businesses often use Shared Hosting and the "GrowBig" plan. Free LetsEncrypt SSL included.

Create Your Own Graphics
Website headers and banners are easy to do yourself when you have this inexpensive tool!