1- dans function.php
définiser la nouvelle taxonomy :
add_action( 'init', 'addresse_init' );
function addresse_init() {
// create a new taxonomy
$labels = array(
'name' => __( 'adr Categories', APP_TD ),
'singular_name' => __( 'Annonce Category', APP_TD ),
'search_items' => __( 'Search Annonce Categories', APP_TD ),
'all_items' => __( 'All Categories', APP_TD ),
'parent_item' => __( 'Parent Annonce Category', APP_TD ),
'parent_item_colon' => __( 'Parent Annonce Category:', APP_TD ),
'edit_item' => __( 'Edit Annonce Category', APP_TD ),
'update_item' => __( 'Update Annonce Category', APP_TD ),
'add_new_item' => __( 'Add New Annonce Category', APP_TD ),
'new_item_name' => __( 'New Annonce Category Name', APP_TD ),
'add_or_remove_items' => __( 'Add or remove Annonce categories', APP_TD ),
'menu_name' => __( 'adr', APP_TD ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => false,
'hierarchical' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'listings/category', 'with_front' => false ),
);
register_taxonomy( VA_LISTING_ADDRESSE, VA_LISTING_PTYPE, $args );
}
2-dans la page que vous voulez appeler le dropdwon :
<div class="form-field">
<?php wp_dropdown_categories( array(
'walker'=> new SH_Walker_TaxonomyDropdown(),
'taxonomy' => VA_LISTING_ADDRESSE,
'hide_empty' => false,
'hierarchical' => true,
'name' => VA_LISTING_ADDRESSE,
/* 'selected' => $listing->category,*/
'show_option_none' => __( 'Selectionner une Catégorie', APP_TD ),
'class' => 'required',
'orderby' => 'id',
'value'=>'slug'
//'id' => 'ba3333'.$taxonomy
) ); ?>
</div>
définiser la nouvelle taxonomy :
add_action( 'init', 'addresse_init' );
function addresse_init() {
// create a new taxonomy
$labels = array(
'name' => __( 'adr Categories', APP_TD ),
'singular_name' => __( 'Annonce Category', APP_TD ),
'search_items' => __( 'Search Annonce Categories', APP_TD ),
'all_items' => __( 'All Categories', APP_TD ),
'parent_item' => __( 'Parent Annonce Category', APP_TD ),
'parent_item_colon' => __( 'Parent Annonce Category:', APP_TD ),
'edit_item' => __( 'Edit Annonce Category', APP_TD ),
'update_item' => __( 'Update Annonce Category', APP_TD ),
'add_new_item' => __( 'Add New Annonce Category', APP_TD ),
'new_item_name' => __( 'New Annonce Category Name', APP_TD ),
'add_or_remove_items' => __( 'Add or remove Annonce categories', APP_TD ),
'menu_name' => __( 'adr', APP_TD ),
);
$args = array(
'labels' => $labels,
'public' => true,
'show_in_nav_menus' => true,
'show_ui' => true,
'show_tagcloud' => false,
'hierarchical' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'listings/category', 'with_front' => false ),
);
register_taxonomy( VA_LISTING_ADDRESSE, VA_LISTING_PTYPE, $args );
}
2-dans la page que vous voulez appeler le dropdwon :
<div class="form-field">
<?php wp_dropdown_categories( array(
'walker'=> new SH_Walker_TaxonomyDropdown(),
'taxonomy' => VA_LISTING_ADDRESSE,
'hide_empty' => false,
'hierarchical' => true,
'name' => VA_LISTING_ADDRESSE,
/* 'selected' => $listing->category,*/
'show_option_none' => __( 'Selectionner une Catégorie', APP_TD ),
'class' => 'required',
'orderby' => 'id',
'value'=>'slug'
//'id' => 'ba3333'.$taxonomy
) ); ?>
</div>