• if i am using this code to display the child pages:

    <?php
      if($post->post_parent) {
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      $titlenamer = get_the_title($post->post_parent);
      }
    
      else {
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      $titlenamer = get_the_title($post->ID);
      }
      if ($children) { ?>
    
      <h2 style="text-align:center;margin:0px"> <? echo $titlenamer ?> </h2>
      <ul>
        <?php echo $children; ?>
      </ul>
    
    <?php } ?>

    how would i style the sub page title and then the sub sub page title.
    When i add a class to the ul, it carries over to all the li items.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Use something like:

    <ul class="subpages">
        <?php echo $children; ?>
      </ul>

    Then style on .subpages and .subpages ul etc.

    Thread Starter xmatter

    (@xmatter)

    hello esmi, in another forum i post, you directed me to use:

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1');
      if ($children) { ?>
    
      <ul class="subpages">
    
      <?php echo $children; ?>
    
      </ul>
      <?php } ?>

    which worked as i needed it to. from your post above, i am trying to add styling now. here is my current code:

    .subpages
    .subpages ul {}
    .subpages li {display:inline-block; margin:10px}

    my question is, is it possible to display the first sub pages with one set of styling, and then when clicked, style the sub sub page links with another style. i assume i can use something like:

    .subpages
    .subpages ul {}
    .subpages ul li {display:inline-block; margin:10px}
    .subpages ul li ul {}
    .subpages ul li ul li{}

    I’d need to see examples of these pages.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘using wp_list_pages’ is closed to new replies.