WordPress get category and subcatagory

WordPress get category and subcatagory

In this poat we will show you how to WordPress get category and subcatagory. At some point when utilizing WordPress custom menu, you would prefer not to include the tyke class from parent classification into the made menus. Be that as it may you need the tyke classification to indicate when you are perusing guardian class, this is helpful on the off chance that you have a wide assortment of sub-class for a specific classification.

In this poat exercise of WordPress get category and subcatagory, its simple to demonstrate all the sub classes from the present parent classification you are seeing. Simply include this bit code into anyplace you need in format, ideally in sidebar or some place close to the route menus.

if (is_category())
$set_this_category = get_category($cat);
$set_this_category = wpxs_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$set_this_category->category_parent."&echo=0"); else $set_this_category = wpxs_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$set_this_category->cat_ID."&echo=0");
if ($set_this_category)
<?php echo $set_this_category; ?>

OUTPUT for WordPress get category and subcatagory

As a rule, you will be including top level parent class into your custom menu yet all the others kid and grandchild classification will be escaped the site so clients won’t have the capacity to peruse them.

// output of WordPress get category and subcatagory
category 1
-  subcatagory 1
-  subcatagory 2
-  subcatagory 3
category 2
-  subcatagory 4
-  subcatagory 5
category 3
-  subcatagory 6
category 4
-  subcatagory 7

Hope this code and post will helped you for implement WordPress get category and subcatagory. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org

Leave a Comment

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

16  +    =  26

We accept paid advance and paid guest Posting on our Site : Contact US