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:
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!” />
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”?
- The topic ‘Create a dual dropdown with Parent Pages and Child Pages’ is closed to new replies.