Grow your CSS skills. Land your dream job.

[Solved] WordPress main navigation and child

  • # August 26, 2009 at 7:17 am

    Hello, this is my first post and I must say well done to Chris Coyier this is a brilliant website. I use it a lot as I’m fairly new to using wordpress in terms of it’s existance, the videos have been amazing to refer to it times of need – thanks!

    Anyway, is there a way of displaying only the child Navigation pages of a parent sections of pages on a separate part of a web page, for instance you have main parent page menu items along the top of a webpage and then display only the subpages of the parent along the bottom, this would mean that depending on the parent selected – the child menu item would be different along the bottom, hope this makes sense?

    # August 26, 2009 at 1:22 pm

    The codex is always the best place to start http://codex.wordpress.org/Template_Tags/wp_list_pages#List_subpages_even_if_on_a_subpage

    Just put this in your template where ever you want the list.

    Code:
    < ?php
    if($post->post_parent)
    $children = wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&echo=0″);
    else
    $children = wp_list_pages(“title_li=&child_of=”.$post->ID.”&echo=0″);
    if ($children) { ?>

      < ?php echo $children; ?>

    < ?php } ?>

    # August 26, 2009 at 2:00 pm

    I always do try codex but I get lost in the terminology

    $post is a variable, do I need to declare it? or do I need to declare post_parent?

    # August 26, 2009 at 2:11 pm

    Ah kewl, got it, thanks for the post

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".