Displaying only selected categories

I am trying to show only selected categories (or taxomony) from the dropdown, right now my code jumps off to another page of the selected category. How Can i do that?

$option ;
$categories = get_categories();
foreach ($categories as $category) {
$option .= ‘<option value=”‘.get_option(‘home’).’/category/’.$category->slug.'”>’;
$option .= $category->cat_name;
//$option .= ‘ (‘.$category->category_count.’)’;
$option .= ‘</option>’;
}
echo $option;

Read more here:: Displaying only selected categories

Leave a Reply

Your email address will not be published. Required fields are marked *