admin管理员组文章数量:1313006
I am attempting to create section of my website footer that has link li of terms from a parent for a custom taxonomy I created.
function add_custom_taxonomies() {
// Add new "producttype" taxonomy to products
register_taxonomy('producttype', 'product', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Producttypes', 'taxonomy general name' ),
'singular_name' => _x( 'Producttype', 'taxonomy singular name' ),
'search_items' => __( 'Search Producttypes' ),
'all_items' => __( 'All Producttypes' ),
'parent_item' => __( 'Parent Producttype' ),
'parent_item_colon' => __( 'Parent Producttype:' ),
'edit_item' => __( 'Edit Producttype' ),
'update_item' => __( 'Update Producttype' ),
'add_new_item' => __( 'Add New Producttype' ),
'new_item_name' => __( 'New Producttype Name' ),
'menu_name' => __( 'Product Type' ),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'Producttype', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/locations/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}
add_action( 'init', 'add_custom_taxonomies', 0 );
I have a parent that i created for the taxonomy "producttype" called "Type" I would like to get only those child terms under the parent term "Type" and display them as a link. I created the parent term in the wordpress dashboard manually.
I am attempting to create section of my website footer that has link li of terms from a parent for a custom taxonomy I created.
function add_custom_taxonomies() {
// Add new "producttype" taxonomy to products
register_taxonomy('producttype', 'product', array(
// Hierarchical taxonomy (like categories)
'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x( 'Producttypes', 'taxonomy general name' ),
'singular_name' => _x( 'Producttype', 'taxonomy singular name' ),
'search_items' => __( 'Search Producttypes' ),
'all_items' => __( 'All Producttypes' ),
'parent_item' => __( 'Parent Producttype' ),
'parent_item_colon' => __( 'Parent Producttype:' ),
'edit_item' => __( 'Edit Producttype' ),
'update_item' => __( 'Update Producttype' ),
'add_new_item' => __( 'Add New Producttype' ),
'new_item_name' => __( 'New Producttype Name' ),
'menu_name' => __( 'Product Type' ),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'Producttype', // This controls the base slug that will display before each term
'with_front' => false, // Don't display the category base before "/locations/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}
add_action( 'init', 'add_custom_taxonomies', 0 );
I have a parent that i created for the taxonomy "producttype" called "Type" I would like to get only those child terms under the parent term "Type" and display them as a link. I created the parent term in the wordpress dashboard manually.
Share Improve this question asked Feb 13, 2015 at 17:03 steamfunksteamfunk 6453 gold badges13 silver badges26 bronze badges1 Answer
Reset to default 1get_term_children()
should be able to do just that. The example in the link looks good.
本文标签: Getting List of child terms from custom taxonomy parent
版权声明:本文标题:Getting List of child terms from custom taxonomy parent 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741856343a2401364.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论