WordPress.org

Ready to get started?Download WordPress

Forums

Display sub pages (1 post)

  1. mitcho
    Member
    Posted 7 years ago #

    Hi All.

    I have a top level page on my wordpress site called 'Poker', and two sub-pages to this page.

    on the side bar of the poker page, i want to display the subpages. but i only want to display these two subpages on the poker page only, no other page. the poker page is ID=3

    Currently my sidebar code looks like this:

    <div id="sidebar">
    <h2>
        <?php _e('Categories'); ?>
      </h2>
      <ul>
        <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 0, 1, 1, 1, 0,'','','','','') ?>
      </ul>
    

    I was thinking i would need to add something above this like (ive written in pseudo-code because i dont really know php):

    <h2>Sub-pages</h2>
    <ul>
    <?php
     if (pageID=3 && hasSubpages = true){
        for (i=0,i<numberOfSubpages,i++){
          echo ('<li>'.subpage.'</li>')
         }
    }
    </ul>
    

    Or something like that, i think thats the basic logic needed. hoping to get some help from someone that knows php or has done something like this! cheers.

Topic Closed

This topic has been closed to new replies.

About this Topic