I want to display posts for multiple categories. I have created a MULTISELECT drop down of all categories using code below:
<form method="get" action="<?php bloginfo('home');?>" >
<select name="cat" multiple>
<option value=""><?php echo esc_attr(__('Please Select Your Choice')); ?></option>
<?php
$categories= get_categories('show_count=0&orderby=name&echo=0&hierarchical=true&depth=1&taxonomy=category&exclude=1');
foreach ($categories as $category) {
$option = "<option value=$category->term_id>";
$option .= ucfirst($category->cat_name);
$option .= '</option>';
echo $option;
}
?>
</select>
<input type="submit" id="searchsubmit" value="Search" name="submit"/>
</form>
Whenever i selects more than one category, I can see all cat ids in url like: http://abcd.com/?cat=7&cat=8&cat=9 But it displays only last category posts using archieve.php file. I want to display all selected category posts on the page.
Thanks in advance.
$(".multiselect").attr( 'multiple', 'multiple' );see it here - Amit Kumar Gupta