PhotoDune

Hiding categories which I don't know ID's of?

42 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United Kingdom
ravravrav says

I know that

<ul>
<?php wp_list_categories('orderby=name&exclude=3,5,9,16'); ?> 
</ul>

Can be used to hide certain categories. However, this assumes I know their ID’s.

If I have a theme and I ask my client to make a category called ‘headlines’ and want that category to be excluded how can I do that if I don’t know the ID?

123 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • United Kingdom
adam_robinson says

a lot of people use custom theme options and ask the user to input the categories they want to exclude here. sorry i cant be any more help i’m no wordpress guru

348 posts Don't be a HATER!
  • Exclusive Author
  • Has been a member for 3-4 years
  • Elite Author
  • Won a Competition
  • Sold between 100 000 and 250 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
webinpixels says
try this
<?php $hideId = get_cat_ID( "headlines" );
wp_list_categories('orderby=name&exclude=' . $hideId . '');
 ?> 

good luck

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says

I’m using this in my navigation:

wp_list_categories('orderby=name&title_li=&hide_empty=1&exclude=1,'.get_option("ill_nav_exclude"));

and this in my control panel, the user inputs the ID’s of Categories and Pages they want to exclude.

array( "name" => "Navigation Exclude",
    "desc" => "Enter a Category or Page ID (separate multiple by commas) to remove them from the navigation",
    "id" => $shortname."_nav_exclude",
    "type" => "text",
    "std" => ""),
by
by
by
by
by