Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #362055

    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

    #362247

    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

    #362289

    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

    #362701

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.