• Hi all.

    I have a pretty complex setup of pages being used as a CMS for a large corporate site (http://www.televox.com), and I’m using this current technique for each section’s submenu on the right side:

    elseif ((is_page(‘automotive’)) || (is_page(’29’)) || (is_page(‘147’)) || (is_page(‘148’))) {

    This is working, except that everytime I add a new page to the section, automotive for instance… I have to hardcode another || statement in order to have the other submenu items appear on the other subpages of that section.

    I would love it if there was something similar to child_of=’automotive’

    Any better way to do this than I am doing it?

    Thanks a ton!

    — Todd

Viewing 8 replies - 1 through 8 (of 8 total)
  • The only way I’ve been able to do it is to create different sidebar pages, and then a different template for each type of page… for example, automotive.php, casino.php, etc… and then have a different sidebar for each one… ex. auto-sb.php, casino-sb.php, etc. Then you can call up child pages for each category only.

    Thread Starter scarecrow

    (@scarecrow)

    Hmm.. thanks ladydelaluna.

    That’s kinda how I am doing it now.. I actually have a custom template, which calls a seperate sidebar.php file for each product line. And then inside of that, I am using the structure I outlined above, to segment each product category by it’s intended market (automotive, casino, etc…)

    This just seems horribly inefficient – There should definitely be a way to group pages and sub pages together.

    Using WP as a CMS is frustrating, because it is soooo close to working the way you need it, but then minor issues such as this come up, and question your use of it at all.

    Oh well, maybe WordPress 3.

    Thanks again.

    I believe there is a way to include only the children of one category… with one piece of code that doesn’t require you to update it every time… try poking around here: http://codex.wordpress.org/Template_Tags/wp_list_pages and see if you can’t find the exact format… I’m unsure of it myself.

    But I know there’s a way to do it with one php function, without having to go in and call each one up with the equivalent of a “hard code”

    I’m trying to figure out the same thing. Any luck?

    You can have a code which on every parent Page will show only the list of its children Pages – if that’s what you want.
    See: http://wordpress.org/support/topic/49712?replies=11

    Thanks moshu>> I responded in the thread you specified: http://wordpress.org/support/topic/49712?replies=11

    Kind of works the way I need, except the when a child page is clicked the menu changes.

    I have figured out how to do what I want: first install this plugin http://wordpress.org/support/topic/32422

    and

    fold_page_list plugin

    then in your template use something like:

    if (tbr_is_descendant_of(3))
    {
    wswwpx_fold_page_list(“title_li=&depth=3&child_of=3&show_date=modified&sort_order=ASC&date_format=$date_format&sort_column=menu_order”, ‘TRUE’);
    }

    As I’ve been searching for the same functionality for too long now, I’ve written one on my own.

    is_child( “ParentCategory” )
    is_child( 10 )
    is_child( “a-nice-slug” )

    Works for categories, posts and pages as well. As for posts, it checks all of a posts categories and all of their parents. Recursively. Or not, if you don’t want it to.

    Check it out at
    http://erik.range-it.de/wordpress/plugins/is_child/

    If you got any ideas, hints, helps or bugs, please leave your feedback.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘sidebar – Is there an is_child for pages?’ is closed to new replies.