• Resolved rmaxfiel

    (@rmaxfiel)


    Hello,

    On our site, we have CommentPress operating for purposes of commenting on individual paragraphs on Pages, but we’d like to be able to include a generic single comment box on Posts. Is there a built-in way to do this already? I thought I’d check before trying to code something.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Christian Wach

    (@needle)

    Interesting scenario – I don’t think it’s been requested before. Are you after a comment form at the foot of the content in the main column rather than in the sidebar? If so, it’s not something that can’t be done via any of the plugin settings.

    The “General Comments” page already has the comment form in the main column, so it shouldn’t be a lot of work to adapt the way that works for the CPTs which you want to exhibit this behaviour. I’d be happy to lend a hand if you fork the GitHub repo.

    Cheers, Christian

    Thread Starter rmaxfiel

    (@rmaxfiel)

    It can be in the sidebar – we just don’t want to split it by paragraphs. There’s no built-in setting for that, is there?

    I’ve tried pulling in comments_template without invoking the sidebar as such, but something there still isn’t loading correctly, even putting aside the “still split by paragraph” thing – better keep looking, I guess!

    Nothing’s currently up in github but I can put it up if that’d help.

    Plugin Author Christian Wach

    (@needle)

    Okay, I think I’ve found a solution for you. In your CommentPress settings under “Post Types on which CommentPress Core is enabled” switch off the ‘post’ post type and save the settings. Then add the following to a plugin or the functions.php file of your child theme:

    /**
     * Allow certain CPTs to be commentable, but not by paragraph.
     */
    function my_override_commentable_status() {
    	global $post;
    	if ( $post->post_type == 'post' ) {
    		add_filter( 'cp_is_commentable', '__return_true' );
    	}
    }
    
    // hook into 'wp' action after CommentPress
    add_action( 'wp', 'my_override_commentable_status', 20 );
    

    You should have a commentable post without paragraph-level commenting.

    Thread Starter rmaxfiel

    (@rmaxfiel)

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Single comment box on posts’ is closed to new replies.