How to Add Comment Tabs for Multiple Comments Plugins
Blog Comments Tabs
Embed Disqus, forum replies, and other conversation platforms to your comments section.
Paste the following into your functions.php
file (easy), or to loader.php
(advanced)
<?php
/**
* Manipulate page templates.
*
* @since 1.0
*/
function md_child_templates() {
// Load new tabs
if ( md_has_comments() ) {
add_action( 'md_comments_tabs', 'md_comments_wp_tab' );
add_action( 'md_comments_tabs', 'md_child_disqus_tab' );
add_action( 'md_hook_comments', 'md_child_disqus_embed' );
}
}
add_action( 'template_redirect', 'md_child_templates' );
/**
* Disqus tab link.
*
* @since 1.0
*/
function md_child_disqus_tab() { ?>
<span id="md_disqus_tab" class="comment-tab md-tab active" data-tab="md_disqus" data-post-id="<?php echo get_the_ID(); ?>"><i class="md-icon-comments"></i> <?php echo __( 'Disqus', 'md-child' ); ?></span>
<?php }
/**
* Disqus embed code.
*
* @since 1.0
*/
function md_child_disqus_embed() { ?>
<div id="md_disqus" class="disqus-comments active block-mid-tb block-full-lr md-tab-content">
<p>Enter Disqus embed code here.</p>
</div>
<?php }
Most comments plugins take over the default comments section, but sometimes you want to offer multiple comments sections for your forums, Disqus, and other kinds of discussion features.
With a few simple actions in MD you can bypass this limitation and embed conversation platforms from others sites without losing your hard earned blog comments.
