Post a Free Classified
  • Contactus
  • Live Cricket
  • Recipes
  • Lamp
  • Classifides
  • Home
Alertinfo lamp
Get subcategories from parent category

In this article we will show you how you can display subcategories by using specific category parent.Please check below code.Assume my parent category id is 23, so i want to display all subcategories under 23(parent category) id.

$subcategories = get_categories(‘&child_of=23&hide_empty=0′); // Here i am passing my id 23 then i am getting results as array.

foreach ($subcategories as $subcategory) { echo $subcategory->name.’
’; } // By using foreach loop we can show subcategories like this.

Enjoy a day.

Leave a Reply

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

*

Login with Facebook:
Log In