Hi all,
We have three post categories for different types of news.
We would only like to show the comments box below one of those categories of posts and hide it when viewing posts of the other categories.
Is that easy to achieve?
Thanks
Hey d24media!
You can edit your pos, click on “screen options” on the top right corner and check “discussion” – http://i.imgur.com/UckwNC7.png
then scroll down to discussion section and choose not to display discussion on your post
Regards,
Yigit
Thanks Yigit,
We need to be able to set this at post category level though, not have to edit each individual post.
So for example I need to set that:
Posts that are marked as Category 1 will always have the comments box at the bottom of the post
Posts that are marked as Category 2 will not show the comments box at the bottom of the post
Hi!
You can add this on functions.php:
add_filter('body_class','avf_add_category_to_single');
function avf_add_category_to_single($classes) {
if (is_single() ) {
global $post;
$id = avia_get_the_id();
foreach((get_the_category($id)) as $category) {
// add category slug to the $classes array
$classes[] = "category-" . $category->category_nicename;
}
}
// return the $classes array
return $classes;
}
Hide the comment on specific category with this on Quick CSS:
.category-categorynamehere .comment-entry.post-entry {
display: none;
}
Change the category name.
Best regards,
Ismael