ThemeShaper Forums » Thematic

[closed]

frustration with wp_list_pages

(1 post)
  • Started 3 years ago by krowchuk
  • This topic is not resolved
  1. Hi!

    I am retooling my theme, was using a customized Kubrick and am now trying to recode it to use a child theme under thematic. I've actually managed to figure most stuff out but am currently stuck at this point.

    On my current theme I have a page with subpages under it. On the top level page I have a list of all the subpages. I hardcoded this onto a custom template using code I found on the codex, and it works great.

    I'm having a problem moving the code over to thematic.

    Here is the code on my current site, that works.

    <?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) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>

    On my current theme it only shows a list of the parent page and the children pages, but on thematic it shows a list of every page on my site?

    For thematic I wrote this code in functions.php

    // Add child page list
    
    function childnav() {
    ?>
    
    <div id="articles">
      <ul>
        <h2>Training Articles by Chris Krowchuk</h2>
    
    <?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) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>
    
      </ul>
    </div><!--end articles -->
    
    <?php
    }
    add_action('thematic_belowpost', 'childnav');

    What i would like to accomplish is to have this list of child pages only occur on pages that have children, or are children -> and to only show the parent and the children pages in the list. Is this possible without using and assigning a special page template to those pages? I'm not even sure how one would do that with thematic.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.