WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to exclude a child page from the list (6 posts)

  1. davidzupec
    Member
    Posted 1 year ago #

    Hello all, I'm trying to figure out how I can exclude a child page from not displaying on my list. Here's my code I got from codex. Any help would be appreciated.

    <?php
    				  $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
    				  if ($children) { ?>
    				  <ul>
    				  <?php echo $children; ?>
    				  </ul>
    				 <?php } ?>
  2. potentweb
    Member
    Posted 1 year ago #

  3. davidzupec
    Member
    Posted 1 year ago #

    Thank you I'm aware of exclude. But where do I put it? I put it like below but it doesn't work.

    $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0','exclude=157');
  4. potentweb
    Member
    Posted 1 year ago #

    $children = wp_list_pages('exlude=157&echo=0&title_li=&child_of='.$post->ID.');

    Correct syntax above.

  5. davidzupec
    Member
    Posted 1 year ago #

    Thank you so much potentweb! : )

  6. potentweb
    Member
    Posted 1 year ago #

    No problem :)

Topic Closed

This topic has been closed to new replies.

About this Topic