WordPress.org

Ready to get started?Download WordPress

Forums

where is the code to display page list? (3 posts)

  1. meganlee1984
    Member
    Posted 3 years ago #

    I'm trying to make a dynamic menu so I need to edit some of the code, but I don't know where to locate it.

    I'm looking for this code:

    <?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 } ?>
  2. Curtiss Grymala
    Member
    Posted 3 years ago #

    If that code exists at all, it will be inside of the theme files for the theme you're currently using. However, not all themes necessarily have that code, so you might not find it. Those that do will all have that code in different places (and it might not look exactly like that).

    Where on your site does the list of pages actually appear? If it's across the top of the screen, then you'd probably find the code in the header.php file (though not definite); if it appears on the side of the screen, it could be in sidebar.php or index.php. It might even be in multiple files, depending on how the theme is set up.

    Good luck.

  3. meganlee1984
    Member
    Posted 3 years ago #

    Hi,
    First off, thanks for your response.

    Second, the code is in the sidebar, but its pulled in from a widget so I believe that its defined in the header.

Topic Closed

This topic has been closed to new replies.

About this Topic