wp_dropdown_categories
-
Hi,
I am working with the wp_dropdown_categories function in wordpress.
here is the code I am using:
<form action=”<?php bloginfo(‘url’); ?>” method=”get”>
<?php wp_dropdown_categories(‘child_of=1&show_count=1&’); ?>
<?php wp_dropdown_categories(‘child_of=3&show_count=1&’); ?>
<?php wp_dropdown_categories(‘child_of=4&show_count=1&’); ?>
<input type=”submit” name=”submit” value=”view” />
</form>Now what this does is show posts from only the last wp_dropdown_categories().
What I am trying to achieve is that the site user can select from all three drop downs and it would return posts matching all 3 selections , meaning that the posts returned would be in ALL 3 categories. If the post is NOT in ALL 3 of the selected categories it should not be displayed. For example if a post is in one category but not the other 2 it would not display.
I know next to nothing about php so any guidance at all would be appreciated.
My thinking is that I need to output the results of each drop down selection into an array that would then be used to populate a wp_list_categories() with the selected categories as arguments.
Am I on the right track? and if I am, how would I do this? as I have no clue and am stumbling round in the dark here. MY PHP knowledge is barely at beginners level.
Many thanks for any help with this.
Ash
- The topic ‘wp_dropdown_categories’ is closed to new replies.