WordPress.org

Forums

Foldable page list (WP 1.5) (44 posts)

  1. roblgs
    Member
    Posted 9 years ago #

    I have a plugin that will automatically expand only the sub-pages of the currently selected page in a page list, collapsing all others to their parent page. Expansion reveals one level deeper than the currently selected page, down to a maximum level determined by the value of the 'level' argument.

    So, for a hierarchy consisting of:

    Fruit
    - Apples
    -- Red
    -- Green
    - Pears
    -- Soft
    -- Hard
    Vegetables
    - Beans
    -- Runner beans
    -- Broad beans
    - Greens
    -- Cabbage
    -- Lettuce

    With nothing selected and level=3, it would show as:

    Fruit
    Vegetables

    Selecting Fruit would show:

    Fruit
    - Apples
    - Pears
    Vegetables

    Selecting Apples would reveal

    Fruit
    - Apples
    -- Red
    -- Green
    - Oranges
    Vegetables

    Selecting Vegetables would reveal

    Fruit
    Vegetables
    - Beans
    - Greens

    etc...

    It should retain all functionality of the standard wp_list_pages plugin since it is implemented as merely a modified (& renamed) version of that tag, but adds the selective unfolding of the page hierarchy. Syntax is identical to its precursor tag.

    A page explaining installation and use, and a link to a downloadable zip archive is available at http://www.webspaceworks.com/wp-plugins/foldpagelist.html.

    I hope others might find it useful, and welcome any feedback.

  2. Deborah
    Member
    Posted 9 years ago #

    I clicked on your link, but got an error message. Is there another link where I can access this plug-in? Thanks!

  3. vkaryl
    Member
    Posted 9 years ago #

  4. roblgs
    Member
    Posted 9 years ago #

    Apologies... I seem unable to now edit the post, but vkaryl has posted the correct link. Thanks

  5. vkaryl
    Member
    Posted 9 years ago #

    Welcome, and it's a nifty thing - got some thoughts about how to use it....

  6. Deborah
    Member
    Posted 9 years ago #

    Downloaded and uploaded onto my server successfully. How can I collapse the pages that I have listed and will post in the future?

  7. roblgs
    Member
    Posted 9 years ago #

    How were you doing this (listing them) previously? The plugin is, in many ways, a replacement for wp_list_pages, so whatever worked with that should, I think, work with this... yours though is one scenario that hasn't been tested for, and I hadn't in fact even considered.

    Do you mean pages that are within your hierarchy, but for which there is no content yet?? Can you explain a little more?

  8. Deborah
    Member
    Posted 9 years ago #

    What I've been doing is creating a blank page for the parent categories, and then individual pages for each of my articles. To get an idea, visit my site at http://thewritersbuzz.com.

  9. roblgs
    Member
    Posted 9 years ago #

    OK, so at which point do you wish to collapse to... or is it more a question of excluding parent pages for which there are no children?

    If it is more driven by 'the page exists, but the article not yet written', then it becomes content related (rather than structure) and outside the scope of this plugin... at least in its current form.

    I'd like though to understand further, but it seems as if your implementation through pages is somewhat duplicating behaviour that might more easily be provided through the categories/posts mechanism of the blog side of things... including future posting.... Not a criticism, just an observation.

  10. Deborah
    Member
    Posted 9 years ago #

    What I'd like to do is keep the parent pages in view, collapsing the child pages so the sidebar will look less cluttered. Ideally, all the user would need to do is click on the parent page to display the child pages. But, I'm thinking that I won't be allowed to do this at all.

    The way I have things set up now is that I have a blank page that displays the title of each of the parent categories I created (i.e., Blogging, Media & PR, Internet Marketing, etc.). When I create a new page for an article, I categorize it as a child page for the relevant parent page.

  11. Deborah
    Member
    Posted 9 years ago #

    "but it seems as if your implementation through pages is somewhat duplicating behaviour that might more easily be provided through the categories/posts mechanism of the blog side of things... including future posting.... Not a criticism, just an observation."

    That's exactly what I did. I wasn't clear on how to create subpages in any other way. I tried reading the Codex but got more confused.

  12. roblgs
    Member
    Posted 9 years ago #

    The first para is exactly what fold page list is meant to do, but clicking one of the parent pages will load that page, and expand that part of the page list, but the page itself is empty, which feels odd.

    Fold page list works off the current request id, in this case the id of the currently loaded page, to determine what gets compressed/expanded. Fold page list does not expand/contract in-place since it is not javascript based, which sounds more like what you are looking for.

    One way around this might be to have it such that the parent pages act as an introduction to that section/group of articles... at least that would get away from the empty page scenario, but with a tidier page list on each load.

    Does that make sense?

  13. Deborah
    Member
    Posted 9 years ago #

    Yes, it does. I could implement a table of contents on the parent pages. I'll have to read up on the Codex again to determine how not to display the child pages. Thanks for your help. :)

  14. roblgs
    Member
    Posted 9 years ago #

    Probably in sidebar.php of your theme, wherever you are calling wp_list_pages, you could add '&level=1' to the end of your arguments list... or '?level=1' if you don't currently use any arguments.

    Alternatively, using the fold page list plugin, use the following:

    wswwpx_fold_page_list ('?level=2');

    in place of wp_list_pages. The value of 2 means 'parents and children as far as 1st generation'... but the expansion will only be on the currently selected parent, all others should collapse.

  15. henrikf
    Member
    Posted 9 years ago #

    hmm when i try the above i get a error.

    Fatal error: Call to undefined function: _wswwpx_() in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/fold_page_list.php on line 170

    i have this in my themes sidebar.php
    <?php wswwpx_fold_page_list ('?level=2'); ?>

    any clues ? i also tried with my (args) from the wp_list_pages with no luck ... running WP 1.5

  16. roblgs
    Member
    Posted 9 years ago #

    Oops!

    Thanks for pointing this out. An embarassing 'cut-n-paste' introduced bug that wasn't being trapped in my testing... now fixed.

    Download fold_page_list v1.0b2 here.

    Also, my reference to:

    wswwpx_fold_page_list ('?level=2');

    should read:

    wswwpx_fold_page_list ('?depth=2');

    But shouldn't have contributed to the problem you encountered.

    Whipes egg from face!

    Let me know if that fixes it for you.

  17. henrikf
    Member
    Posted 9 years ago #

    Tnks 4 the quick fix ...

    Unf. that didnt "cut the mustard" .. i get a new error when i load the wswwpx_fold_page_list ('?depth=2'); from my sidebar.

    ---snip----
    Warning: in_array(): Wrong datatype for second argument in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/fold_page_list.php on line 230
    # Kommande Lajv
    Warning: in_array(): Wrong datatype for second argument in /home/hosts/trollpack/www/trollpack.sverok.net/wp-content/plugins/fold_page_list.php on line 243

    ----/ /---- (and so on four all my depth=2 Pages entrtys. )

    But if i click on the link "Kommande Lajv" the menu loads collapsed and everything works fine .... (no errors)

    My WP site is located in my web root folder (not in a subdirectory) has this something to do with the error ?

  18. roblgs
    Member
    Posted 9 years ago #

    Oops again... this is embarassing... what comes of trying to do too much all at the same time, and not checking...

    Get rid of the question mark in the call, so that it reads:

    wswwpx_fold_page_list ('depth=2');

    As per wp_list_pages syntax.

    That should work... honest!

    The test install I have running is also at the domain root, not in a subdirectory, so that arrangement should not have any negative effect, and anyway, fold_page_list is intended to work exactly the same way as the wp_list_pages tag, upon which it is based.

    Many apologies for the previous wrong info.

  19. henrikf
    Member
    Posted 9 years ago #

    Thanks for clearing the syntax thing up... (but that didnt help eather)
    This thing is not funny .. som function is not playing well with my webpage ...
    i still get error when i load the meny (see full error msg. http://trollpack.sverok.net/2005/04/26/test-sida/ )

    Thank for trying but i dont think i can get this to work :-(
    I will enable the funktion on the main page ...(at the bottom of the sidebar) so you can have a look.. (http://trollpack.sverok.net)

  20. roblgs
    Member
    Posted 9 years ago #

    Henrik,

    Can you contact me at the email address in the header of the file. I think I have a fix, but am unable to duplicate the problem (which is odd, because I think I know the cause!! The error messages were most helpful in that regard).

  21. roblgs
    Member
    Posted 9 years ago #

    OK, I think I've fixed it... the error was occuring when there was no page ID provided from which to determine ancestry, so no array of ancestors.

    A version fixing this problem, fold_page_list v1.0b3 is now available.

    Let me know if this works for you.

  22. henrikf
    Member
    Posted 9 years ago #

    Thanks ! that last fix realy working great :-)
    your patience is very impressing ;-)

    I realy think this plug is worth integrate in the main WP 1.5 branch ..
    If you use the site for other things than a blog this is a excelent way to get a nice site navigation.

  23. knowledgerocker
    Member
    Posted 9 years ago #

    I have uploaded and activated the plugin, yet nothing has changed and I still see all of the child pages. see here: http://blog.knowledgerocker.net/

  24. roblgs
    Member
    Posted 9 years ago #

    How are you calling the tag? Should look something like this:

    wswwpx_fold_page_list ('depth=2');

    contained within php delimiters and probably inside sidebar.php for your active theme.

    The 'depth=2' part can be replaced with any of the arguments you would normally use with wp_list_pages

  25. wessex
    Member
    Posted 9 years ago #

    I've got the fold list plugin to work, finally (I didn't know you had to hack "sidebar.php" - I'm still new to php and WordPress), and very lovely it is too.

    However, it seems to break XHTML validity...

  26. roblgs
    Member
    Posted 9 years ago #

    Thanks for the note about xhtml validation... the output of closing tag on each list item was wrongly nested with respect to an extra 'if' block in the function generating the output, so wasn't being written into the xhtml. Silly error… fixed!

    New beta (1.0b4 [rc1]) now available

  27. wessex
    Member
    Posted 9 years ago #

    Superb! My site is now valid xhtml :-)

    Thanks for the update - the fold page plugin is deeply appreciated...

  28. roblgs
    Member
    Posted 9 years ago #

    Bugfix:
    Thanks to Laurent for reporting a problem with duplicating sub-pages in the output when non-zero 'child_of' argument is supplied.

    A new version Fold Page List 1.0b5 [rc2] that fixes this problem, is now available for download.

  29. brooklynwebguy
    Member
    Posted 9 years ago #

    Today was my first day using WordPress. I couldn't believe how much could be accomplished in one day and how much know-how, expertise and design have been contributed.

    But the problem of foldable menus plagued me all day and you folks have solved it with this perfect plug-in. This puts WordPress one step closer to being a CMS.

    WordPress and its community are really amazing. I have never had LESS frustration with an Open Source product and I have used several.

  30. ianalis
    Member
    Posted 9 years ago #

    Hi! What can I do to exclude the parents and only show its siblings and children?

Topic Closed

This topic has been closed to new replies.

About this Topic