WordPress.org

Ready to get started?Download WordPress

Forums

Style sidebar menu list different for child and parent pages (2 posts)

  1. killertofu01
    Member
    Posted 4 years ago #

    Hi, I found a lot of answers on this forum, so I thank you all for your hard work and help.

    My question today is, I am styling a menu for a friend and can't figure out how to style the child pages different from the parent pages in his sidebar menu.

    Here is the sidebar menu code:

    <?php
    $output = wp_list_pages('echo=0&depth=1&title_li=' );
    if (is_page( )) {
      $page = get_query_var('page_id');
      if ($post->post_parent) {
        $page = $post->post_parent;
      }
      $children=wp_list_pages( 'echo=0&child_of=' . $page . '&title_li=' );
      if ($children) {
        $output = wp_list_pages ('echo=0&child_of=' . $page . '&title_li=');
      }
    }
    echo $output;
    ?>

    Right now, it is all governed by a single div, but since the list is automatically generated, I don't know how to style the children different.

    Thank you all in advance, look forward to getting this fixed.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Site url?

Topic Closed

This topic has been closed to new replies.

About this Topic