Comments Section

  • Unknown's avatar

    I have recently published my first blog post and at the top it says ‘No Comments’. How can I get rid of this? I still want a comments section, I just don’t want everyone to see ‘No comments’. Any help would be greatly appreciated :)

  • Hi there,

    In some themes, there is an option in My Site > Design > Customize to remove it.

    Could you please share your site address so that I can help you in the right direction?

  • Unknown's avatar

    Yeah sure :)

    I use the theme Twenty Twenty and my website address is:

    Home

  • Hi there,

    Twenty Twenty doesn’t have an option to remove the “No Comments” part from Customizer.

    At this point, you have two options:

    Either you can completely remove this using CSS or create a child theme of Twenty Twenty to add code in the functions.php file. With the second method, “Comments” text will only appear if there will be at least 1 comment on the post; otherwise, it will not appear.

    How to remove using CSS?

    Please go to Appearance > Customize > Additional CSS section in your WordPress Admin Area and paste the below CSS there:

    .post-meta .post-comment-link {
        display: none;
    }

    Remove by adding code in the functions.php file of Twenty Twenty child theme:

    Step 1: Create a child theme of Twenty Twenty.

    Step 2: Upload the created child theme using the upload method from WordPress Admin.

    Step 3: Activate the child theme (don’t delete the Twenty Twenty main theme).

    Step 4: Go to Appearance > Theme Editor > Make sure Twenty Twenty child theme is selected > functions.php and in the bottom add the below code:

    add_filter(
    		'twentytwenty_post_meta_location_single_top',
    		function() { 
    		if( get_comments_number() ) { 
    			return array(
    				'author',
    				'post-date',
    				'comments',
    				'sticky',
    			);
    		} else {
    			return array(
    				'author',
    				'post-date',
    				'sticky',
    			);
    		} }
    	);

    You can also directly paste the above code in your Twenty Twenty main theme’s functions.php file, but you will lose the changes when you update it. The child theme allows you to easily update the main theme without worrying about losing your changes.

    Please note:

    Your website is using the self-hosted WordPress software from WordPress.org.

    To clear up any confusion, WordPress.com and WordPress.org are two different entities: https://wordpress.com/support/com-vs-org

    For the self-hosted website, WordPress.org forums are the best.

    To get help at the WordPress.org forums, please visit here: https://wordpress.org/support/forums 🙂

  • Unknown's avatar

    It worked! Thank you very much for your help bizanimesh :)

  • Always happy to assist. 🙂

  • The topic ‘Comments Section’ is closed to new replies.