Forums

Display only other child pages of same parent in menu (2 posts)

  1. KerimFriedman
    Member
    Posted 5 years ago #

    I've spent the morning looking around for solutions to the following problem:

    I'm using WP to create a static web site (not a blog), using the pages functionality. Using the ability to create a page hierarchy, I would like a menu that only displays other pages in the same "branch". For instance, if I have a top level item called "About" with sub pages "Contact", "Location", and "History". And another top level item called "Courses" with a list of courses offered by my program, I'd like to have a menu which either shows the three sub-pages in the "About" section or the list of courses - but not both.

    The closest thing I found is the excellent Fold Page List plugin:

    http://www.webspaceworks.com/resources/cat/wp-plugins/30/

    However, that does not seem to have an option to hide the parent items - it just hides the children of other parent items.

    This looked promising, but I could not get it to work:

    http://wordpress.org/support/topic/78925

    In the end, I used the TBR Article family plugin from this thread:

    http://wordpress.org/support/topic/32422

    And created a list of "if" statements for each of my top level pages:

    if (tbr_is_decendant_of(7)) wp_list_pages("title_li=&child_of=7");
    if (tbr_is_decendant_of(5)) wp_list_pages("title_li=&child_of=5");
    if (tbr_is_decendant_of(2)) wp_list_pages("title_li=&child_of=2");

    This works, but it would be nice to have something that would work automatically without having to edit the PHP code each time I add a new top-level page.

  2. david36362000
    Member
    Posted 4 years ago #

    Have you looked at the WP-Andreas09 2.1 theme by Andreas Viklund and Ainslie Johnson? This theme does what you're looking for. I suppose you could examine their code to see how they got this done.

    I'm using this theme for my CMS-like website and it's working pretty well.

Topic Closed

This topic has been closed to new replies.

About this Topic