我想在一个简短的代码显示子类别列表。我喜欢如果短代码将像[足球_子类别]我要全部列出所有子类别
g6baxovj1#
你可以这样得到它:
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);}
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);
}
1条答案
按热度按时间g6baxovj1#
你可以这样得到它: