Support JetPack Comments in WordPress themes.

Comments… yeah, I leave them for last too.

I hardly can recall a dicent WP theme having nicely working (and looking) comment template. If that’s the case for you would probably like to try the Jetpack Comments extension as a module of the Jetpack plugin for WordPress. Automattic is providing some of the WordPress.com awesomeness as a plugin for self-hosted installations.

To get to the point I will suggest a way to support JetPack Comments in themes. The important thing to know is this module depends exclusively on the comment_form template tag. If your comments.php is not using it, you won’t get Jetpack Comments working.

How to get it working without completely annihilating your comments template.

<!-- just after walking existing comments -->
<div id="respond">
<?php if ( did_action( 'jetpack_comments_loaded' ) ) : ?>
<?php comment_form(); ?>
<?php else: ?>
<!-- here comes default theme's comment form -->
<?php endif; ?>
</div>

That’s how i enabled Jetpack Comment here using the Roots Theme where comment_form wasn’t used also. Now if I need to disable Jetpack for some reason Roots’ default comment form will kick in.

One Response to “Support JetPack Comments in WordPress themes.”

  1. paulvantuyl

    Thank you, very helpful.

    Reply

Leave a Reply to paulvantuyl Cancel reply