505 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • United Kingdom
Gareth_Gillman says

I am using the wp_get_categories in a navigation but there is one theme I want to block, I know I can exclude it by using the ID of it but I don’t want to tell people to edit a file to remove the category from the list.

I found a way to do it but doesn’t work

<?php  
 $id = get_cat_id('blog');  
 $q = "cat=" . $id;  
?>
and then to display the excluded category
 <?php wp_list_categories('orderby=name&title_li=&exclude=<?php echo $q ?>'); ?> 

But it shows up as No categories, instead of the list of categories!

Any ideas welcome

86 posts
  • Author had a Free File of the Month
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 50 000 and 100 000 dollars
BrentChesny says

Try this:

 <?php wp_list_categories('orderby=name&title_li=&exclude='.$id); ?> 
505 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • United Kingdom
Gareth_Gillman says
Try this:
 <?php wp_list_categories('orderby=name&title_li=&exclude='.$id); ?> 

It Works

Thanks a lot

1028 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 500 and 999 users
+1 more
ThemeBlvd says

Yeah. You can’t have PHP tags within PHP tags.

505 posts
  • Bought between 10 and 49 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • United Kingdom
Gareth_Gillman says
Yeah. You can’t have PHP tags within PHP tags.

Oops big boo boo, no idea how I missed that lol

by
by
by
by
by
by