WordPress.org

Ready to get started?Download WordPress

Forums

List Sub pages, except on home page (2 posts)

  1. Josh Fialkoff
    Member
    Posted 4 years ago #

    Hi,

    I am trying to add a list of sub pages to my sidebar.

    I have successfully done that with this code:

    <?php
        global $wp_query;
        if( empty($wp_query->post->post_parent) )
          {
             $parent = $wp_query->post->ID;
          }
        else
         {
             $parent = $wp_query->post->post_parent;
         } ?>
    <?php if(wp_list_pages("title_li=&child_of=$parent&echo=0" )): ?>
        <div id="submenu">
         <ul>
          <?php wp_list_pages("title_li=&child_of=$parent" ); ?>
         </ul>
        </div>
    <?php endif; ?>

    However, I would like to NOT have the "Related" box show up on the home page.

    And I would like to exclude certain pages from showing up (such as the Thank You page beneath the Contact page).

    Does anyone know how to do this?

    Thanks,
    Josh

  2. MichaelH
    Member
    Posted 4 years ago #

    Look at using something like is_home{}.

    See Conditional_Tags.

Topic Closed

This topic has been closed to new replies.

About this Topic