Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1202792
    Jacko_Pinto
    Participant

    Hello.

    1. I’d like to deactivate commenting on posts all together. What we’re doing at this point is simply unchecking the comments box for each new post.

    2. I’d like to add the “Social Sharing” feature for every post so that readers can easily share posts on their social channels.

    Can you please help with that?

    #1202794
    Jacko_Pinto
    Participant
    This reply has been marked as private.
    #1202939
    Prasant Rai
    Moderator

    Hello Jacko,

    Thanks for writing in!

    1) Please use Disable Comments to disable comments.

    2) Inorder to display share icons will requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

    Then add the following code in your Child Theme’s functions.php file:

    function share_for_individual_post( $content ) {
    	if ( is_singular('post') ) {
    		echo do_shortcode( '[share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]' );
    	}
    }
    add_action('x_before_the_content_end', 'share_for_individual_post');

    Let us know how this goes.

    #1203876
    Jacko_Pinto
    Participant

    Thanks for commenting.

    So I’d need to disable comments for each post? Is there any way to disable it automatically for every post?

    Thanks!

    #1203974
    Joao
    Moderator

    Hi There,

    Please add the following code to functions.php of your Child theme.

    function default_comments_off( $data ) {
        if( $data['post_type'] == 'page' && $data['post_status'] == 'auto-draft' ) {
            $data['comment_status'] = 0;
        } 
    
        return $data;
    }
    add_filter( 'wp_insert_post_data', 'default_comments_off' );

    Let us know how it goes,

    Joao

    #1210628
    Jacko_Pinto
    Participant

    Thank you. Will this deactivate comments for active posts or just for the new ones we create?

    I appreciate the help. Best regards.

    #1211011
    Friech
    Moderator

    Hi There,

    This will automatically deactivate the commenting by default for your new/future posts/pages.

    You can disable the Allow Comments option for your existing posts.


    screenshot

    Hope it helps, Cheers!

  • <script> jQuery(function($){ $("#no-reply-1202792 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>