I would like to show subcategory list in a short code. I like if shortcode will be like [football_subcategory]
I want all list all sub category in a list
CodePudding user response:
You can get it like this:
add_shortcode('football_subcategory', 'football_subcategory');
function football_subcategory(){
$taxonomies = array(
'event_cat',
);
$args = array(
'parent' =>1625, //put your parent category ID
'hide_empty' => false, // you can make it true and false
// 'child_of' => $parent_term_id,
);
$terms = get_terms($taxonomies, $args);
//add a loop and get all details about category
echo '<pre>';
print_r($terms);
}