Home

PHP Programming to get Custom Category list in Dropdown from Shortcode

PHP Programming to get Custom Category list in Dropdown from Shortcode
Like Tweet Pin it Share Share Email

[myad1] WordPress is providing default Widget to get the default category drop-down. If you have a custom category in your blog or website then you have to add a plugin or action hooks in the functions.php.

Below is the code which will help you to show the custom category list.  We are using Solutions custom post type and platforms as a taxonomy.  Created a shortcode to get the get the all Platforms list in the dropdown using below code.

Copy above code and paste in the template where you want to show the category list. If you want to use the shortcode then, please use below code and use solutions_caregories as a shortcode and place in the sidebar.

In the above example, we have shown the post counts. If you don’t want  to show the count then replace ‘show_count’ => true to ‘show_count’ => false.

Please do let me know if you have any queries on this and write your thoughts via comments.

 

Comments (0)

Leave a Reply

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

5 × one =