You can add a 1,#,#,# will exclude all the category IDs you don’t want.
If your theme allows it may be best to use custom menus under Appearance > Menus
you might need to make an intermediate step to get the category id from the category name; for instance http://www.wprecipes.com/wordpress-function-get-category-id-using-category-name
What’s the problem with simply excluding it with the ID? I guess what I’m asking is what special are you trying to accomplish that the name is preferable to the ID?
James:
Because I set the category ¨featured¨ in the index as a featured category, that only appear in the home page, with a code that is something like this:
query_post= new WP_query('category_name=featured&pos_per_post=1')
I want that featured category out of the menu. But i don’t know how. I tried make a variable and then calling the id, but exclude don’t allow me to call a variable in the code wp_list_category( 'title_li=&depth=0&exclude=1,featured' ).
Maybe I’m calling it in the wrong way???
alchymyth: I going to try that way thanks for the help.
dskallman: the point is a site with a custom menu. That featured category is killing me. Thanks for the help.
wp_list_category( 'title_li=&depth=0&exclude=1,featured' ).
->> needs to read: wp_list_categories()
how to use a variable in wp_list_categories():
$cat_name = 'featured';
$term = get_term_by('name', $cat_name, 'category');
$featured_id = $term->term_id;
wp_list_categories( 'title_li=&depth=0&exclude=1,' . $featured_id );
btw:
watch your spelling of the wordpress functions – you made a few typos here in the thread – make sure you don’t repeat them in your code, as typing errors are often difficult to trouble shoot.
alchymyth, arigatoooooooooooooo I love you, you are the best, i can’t belive it is done, thank you for the help. Very apreciate (^-^)
Don’t forget the native WordPress function get_cat_ID
i need a filter not for the whole category name but a part of it.
if cat_name contains substring then show it. but i cannot work out the proper php syntax mixing the great code above and strpos()
any ideas?