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:

invalid

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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -