On a recent WordPress website project I was working on, I needed to remove specific categories from the list of categories that the “get_category()” function returns. Carl Bliss discovered the solution on the Technokinetics blog.
First, add the following to functions.php:
cat_name != 'CATEGORY TO EXCLUDE' && $category->cat_name != 'ANOTHER CATEGORY TO EXCLUDE') {
if ($first_time == 1) {
echo 'name ) . '" ' . '>' . $category->name.'';
$first_time = 0;
} else {
echo $separator . 'name ) . '" ' . '>' . $category->name.'';
}
}
}
}
?>
Make sure to replace the “CATEGORY TO EXCLUDE” text with your category’s nicename.
Then add the following to your theme:
That’s it!
1 Comment
More posts from themightymo.com
How I created a Local SEO-Driven WordPress website in 1 hour
This morning, I got curious about the competitiveness of a specific keyword in the Google Map (a.k.a. “Local SEO”). The Google map is this strange beast that I am particularly-curious about, because almost 100% of my customers live within a 10-mile bike ride of my house…and I’d like to have more customers so… The keyword…
WordPress Multisite – A Love Story
Rob says WP Multisite should be put out to pasture – I 100% disagree.
Adding Blur to Quicktime Videos in Post-Production is Easy in Youtube’s Free Browser-based Editor!
I recorded a screencast today of me sharing my live “how to” process for creating a new website. The video is about an hour long, and there were a few small things I wanted to blur on the screen (serial numbers for software). I was surprised that Youtube now has a “blur” effect available after…
//exclude categories with id 1 and 3
$args = array(‘exclude’ => array(1,3));
$categories = get_categories( $args );