Hi!
I need to echo the ID and Name of the user categories. That is, echo terms IDs and names. Is it possible? Any tip about the code?
Thanks a lot and good job! ;)
Hi!
I need to echo the ID and Name of the user categories. That is, echo terms IDs and names. Is it possible? Any tip about the code?
Thanks a lot and good job! ;)
I need the same thing. Please help. How to get current user group?
Please describe your request further.
<?php
function replace_id_for_slug($option){
$categories = get_categories("hide_empty=0&taxonomy=product_tag");
preg_match('/value="(\d*)"/', $option[0], $matches);
$id = $matches[1];
$slug = "";
foreach($categories as $category){
if($category->cat_ID == $id){
$slug = $category->slug;
}
}
return preg_replace("/value=\"(\d*)\"/", "value=\"$slug\"", $option[0]);
}
$select = wp_dropdown_categories("taxonomy=product_tag&hierarchical=1&show_count=1&echo=0");
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
$select = preg_replace_callback("#<option[^>]*>[^<]*</option>#", "replace_id_for_slug", $select);
$select = str_replace("cat","product_tag",$select);
echo $select;
?>You must log in to post.