WordPress.org

Ready to get started?Download WordPress

Forums

Taming the Sidebar for Pages (8 posts)

  1. circuitor
    Member
    Posted 9 years ago #

    Could I please have some suggestions for controlling my Sidebar?
    Like many people, I am using WordPress 1.5 as Blog software and as a content management system(CMS). I have a lot of Pages so when the Pages List shows up in my Sidebar it is really long!
    (I have the Pages List turned off for the Blog pages.)

    Is there any way to tame it down a bit? Specifically- So that the list in the Sidebar only shows the other Pages that are the "children" of that page and the other pages at the same level in the hierarchy (meaning, parallel pages or "brother and sister" pages, to continue the family metaphor)?
    So briefly, the Sidebar shows "Children" and "Brothers" but not "Grand-Children" and not "Parents".

    In example, the way it would ideally work:

    1. If I were making a site called "Food", at the top level the Sidebar Pages List would only say "Meat, Vegetables, Dairy, Fruit".

    2. Then, If I click on "Fruit" it takes me to the Fruit Page and the Sidebar displays "Citrus, Apples, Exotics, Other" and also the parallel pages "Meat, Vegetables, Dairy, Fruit".

    3. Then I click on "Citus" and on the Citrus Page the sidebar says "Oranges, Lemons, Grapefruit, Tangerines" and also "Citrus, Apples, Exotics, Other".

    4. Finally I click on "Oranges" - and that last page having no children (non-parent page) the side bar would only say "Oranges, Lemons, Grapefruit, Tangerines"

    Is there a way to do this? I've been scanning the documentation for a long time but can't seem to see anything remotely relevant.

    thanks a lot!
    ~circuit

  2. Root
    Member
    Posted 9 years ago #

    Well maybe you need cat specific navigation. Use if else or develop seperate templates.

  3. circuitor
    Member
    Posted 9 years ago #

    Thanks for the suggestions.
    Yes, creating separate templates and sidebars is the solution that i'm considering. But, like I mentioned, I have a huge amount of pages and creating templates for them all by hand is gonna take awhile, and won't auto-update...
    My hope is that - because of the regularity of the operation, and the fact that the data is already in the database - there might be a dynamic way to solve it.
    ~c

  4. Root
    Member
    Posted 9 years ago #

    if else would be dynamic.

  5. circuitor
    Member
    Posted 9 years ago #

    I'm familiar with if else statements...
    but what would i test for in my if statement in this case?
    What file should I edit?
    (Sorry if it's obvious. I am good with XHTML but pretty young to PHP, but I'll take a shot at it)
    Thanks...
    ~c

  6. moshu
    Member
    Posted 9 years ago #

    What Root says will help you to display the list when you want. This page from Codex http://codex.wordpress.org/Template_Tags/wp_list_pages will help you to have it as you want :)

  7. roblgs
    Member
    Posted 9 years ago #

    You might like to look at Fold Page List Plugin.

    This is a replacement for wp_list_Pages that 'folds' those parts of the page list that are not relevant to the current page, but leaves all other top level pages visible for navigational purposes.

    b3 is (probably) the final beta before making a formal release of it. I'd be interested in feedback.

  8. circuitor
    Member
    Posted 9 years ago #

    Great!
    Thanks for pointing me right! This is what I was looking for.
    I also found this very helpful thread:
    http://wordpress.org/support/topic/30422

    (feature request: it looks like 'sibling_of' and 'parent_of' parameters would be very useful for future features in WP)
    Anyway... It's working good! Thanks
    ~c

Topic Closed

This topic has been closed to new replies.

About this Topic