• Hi, my blog site is http://alexbrinerblog.com and I have a page called “journals” along with that page I have a sub page for one of my backpacking trips called “pictured rocks” but will be adding more journals of trips.

    right now the only places where you can see the subpages available are on the right hand side with the other links and way at the top which is barely visible and not where someone would look, I am seeing that people visiting my site are going to the journals page but not anywhere from there, I believe this is because the sub pages are not easily seen.

    I would love for there to be a way to have wordpress automatically list in that page with links to the different sub pages. But i cannot find a way. could someone help me with this bit of code to attach? I do have experience with web design and php.

    under the text

    Here I will post copies or excerpts from my journals while on the trail.

    Enjoy and please feel free to comment or ask questions.

    I would love it if it would list in bold the titles of the sub pages and the titles are links.

    I know I can do this manually after I add each page but that would be a bit of a pain, wondering if there is a much simpler way I can just have it automatically add all subpages.

    thanks in advance!
    – Alex

Viewing 1 replies (of 1 total)
  • A related posts/pages plugin would be one avenue (e.g. Yet Another Related Posts Plugin)

    Or, with the help of the Template Hierarchy article, determine what Template is displaying your Pages. Then edit that template and put code like this:

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
    <?php echo '<p>Here I will post copies or excerpts from my journals while on the trail.</p>'?>
    <?php echo '<p> Enjoy and please feel free to comment or ask questions.</p>';?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>

    The above example was derived from wp_list_pages().

    If using the WordPress Default Theme you would likely edit the wp-content/themes/default/page.php file and add that code right before

    </div>
    <?php get_sidebar(); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Code for showing sub pages in list on a parent page’ is closed to new replies.