Hi Is there any option to hide a particular category which is showed in front end, I have a new category name called : computer. I would like to add an Rss feed for that particular category, But i don’t want to show that particular category in front end , Is there any way to make hide that particular category or tags do not make show in front-end , Thanks in advance.
2 Answers
Hi,
Please try the following code, you can add this code to the style.css file:
.dw_focus_widget_news_slider .carousel-entry .cat-links a {
display: none;
}
.cat-links {
color: #fff;
text-indent: -9999px;
}
.cat-links a {
text-indent: -9999px;
position: absolute;
}
Hope this helps !
Nope that does’t works , but i tried with this which is works perfect , Tried this with function.php
add_filter('get_the_terms', 'hide_categories_terms', 10, 3);
function hide_categories_terms($terms, $post_id, $taxonomy){
// list of category slug to exclude,
$exclude = array('computer');
if (!is_admin()) {
foreach($terms as $key => $term){
if($term->taxonomy == "category"){
if(in_array($term->slug, $exclude)) unset($terms[$key]);
}
}
}
return $terms;
}
Awesome! I appreciate it.
Please login or Register to submit your answer