768 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
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
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Located in Belgium
+4 more
BrentChesny says

Try this:

 <?php wp_list_categories('orderby=name&title_li=&exclude='.$id); ?> 
768 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
Gareth_Gillman says
Try this:
 <?php wp_list_categories('orderby=name&title_li=&exclude='.$id); ?> 

It Works

Thanks a lot

1028 posts
  • Has referred 500+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
ThemeBlvd says

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

768 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
Gareth_Gillman says
Yeah. You can’t have PHP tags within PHP tags.

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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by