WordPress.org

Ready to get started?Download WordPress

Forums

how to get all child page in dropdown list of all parents page (4 posts)

  1. me.durgesh
    Member
    Posted 4 years ago #

    I want get all child pages in drop down list of all parent pages

  2. aurelius1
    Member
    Posted 4 years ago #

    Try this...

    <?php
    $children = wp_list_pages(title_li=&child_of='.$post->ID.'&echo=0');
    
    if ($children)
    {
    ?>
       <ul>
    <?php
          echo $children;
    ?>
       </ul>
    <?php
    }
    ?>

    For more options with what is displayed search this site for wp_list_pages

  3. guymclaren
    Member
    Posted 4 years ago #

    Parse error: syntax error, unexpected '=' in ....../wordpress/wp-content/themes/bacs/header.php on line 61

  4. Arie Putranto
    Member
    Posted 4 years ago #

    Typo here

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

    should be

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

    Not the ' ( single quote )

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags