php - DropDown Navigation for Custom Post Types? -
i trying create dropdown menu on navigation in wordpress, using custom post type categories dropdown. example, in products, have 6 different categories:
category category b category c category d category e category f
if go appearance > menus, have option tick categories , add them menu. when this, following:
is there easy solution this?
you'll need use get_categories , roll own menu without using menu_nav() function.
<?php $args=array( 'post_type' => 'category', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'asc', 'hide_empty' => 1, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'pad_counts' => false ); $categories=get_categories($args); echo '<ul>'; foreach ( $categories $category ) { if ( $category->parent > 0 ) { continue; }
Comments
Post a Comment