Custom category dropdown
-
Hi.
Excellent Plugin!! and by far the best support. (This plugin has made my life so much easier while providing extra capabilities for my clients.
Not sure if is worth adding to your documentation (or even if what I did is the correct way of doing things but it works) but I know a few people where looking to use [wpsl] with custom drop down and I stumbled upon the following solution in an older post and it worked great use the following code.
add_filter( 'wpsl_dropdown_category_args', 'custom_dropdown_category_args' ); function custom_dropdown_category_args( $args ) { if ( is_page( id or 'title' or 'page-slug' ) ) { //this is the page you want the custom dropdown to appear on. $args['child_of'] = category id; //The ID of the parent category you want the sub categories to show in the dropdown. } else if ( is_page( id or 'title' or 'page-slug' ) ) { //another page you want a different custom dropdown to appear on. $args['child_of'] = category id; //A different of the parent category you want the sub categories to show in the dropdown. } else if ( is_page( id or 'title' or 'page-slug') ) { //another page you want a different custom dropdown to appear on. $args['child_of'] = category id; //A different ID of the parent category you want the sub categories to show in the dropdown. } return $args; }
This coupled with the following plugin to reorder taxonomies creates easy custom dropdowns. Category Order and Taxonomy Terms Order
With the above code You can add as many else if statements as you need (I had one site with 21 different dropdowns.
Anyway, great work.
- The topic ‘Custom category dropdown’ is closed to new replies.