WordPress.org

Ready to get started?Download WordPress

Forums

Create a dual dropdown with Parent Pages and Child Pages (1 post)

  1. ensignkid
    Member
    Posted 5 years ago #

    I'd like to create a dual dropdown setup on the top of a WordPress blog. Dropdown one would contain only the parent pages. Dropdwon two would contain only the child pages for the currently active parent page.

    So, if the parent pages include:
    Baseball
    Football
    Hockey

    and the user clicks on the Football page and clicks Submit, I'd like the user to be directed to the Football main page. Dropdown one could still show all of the parent pages, but Dropdown two should only display the child pages for Football.

    I'm currently using the WordPress dropdown coding from the Codex.

    ` <form action="<?php bloginfo('url'); ?>" method="get">
    <?php wp_dropdown_pages('sort_order=ASC&exclude=2,3,4'); ?>
    <input type="submit" class="button" name="submit" value="Go!" />
    </form> `

    I've excluded the first 3 pages (2,3,4) because I do not want them shown on Dropdown one. How do I create a second dropdown to show the child pages of the currently active page. What other code would I need to add to this first dropdown to exclude child pages: "depth=1"?

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic