list taxonomy categories of custom post types
-
Hello, As the title states, I am tying to list the taxonomy categories for a specific custom post type created by this plugin, her tis my code so far, no luck.
<select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__('Select Category')); ?></option> <?php $option = '<option value="' . get_option('home') . '/category/">All Categories</option>'; // change category to your custom page slug $categories = get_categories( array( 'orderby' => 'name', 'order' => 'ASC', 'taxonomy' => 'firm_type' ) ); 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; ?> </select>
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘list taxonomy categories of custom post types’ is closed to new replies.