Display sub pages (1 post)

  1. mitcho
    Posted 8 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">
        <?php _e('Categories'); ?>
        <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 0, 1, 1, 1, 0,'','','','','') ?>

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

     if (pageID=3 && hasSubpages = true){
        for (i=0,i<numberOfSubpages,i++){
          echo ('<li>'.subpage.'</li>')

    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