Written by: Aleš Sýkora

The Author of Toolset.wiki. Big fan of Toolset plugins and WordPress.

I am big fan of WordPress and Toolset plugins. I have done many projects based on WordPress. I also have experience with online marketing, PPC advertising and SEO. I live in Czech Budweis – the town of Budweiser Budvar breverage in the south of the Czech Republic – the heart of Europe.

I love skateboarding, snowboarding, frisbee, fitness, healthy lifestyle, tattoos, mountain biking and other sports. I enjoy having time with friends with good beer and good music.

Comments Shortcode for Content Templates

Last Update: 11. 11. 2019 , Category:

The challenge: display comments section in Bootstrap grid in content template of custom post type.

The solution: create custom shortcode for calling comments.php template.

The code:

function comments_template_shortcode() {
ob_start();
comments_template( '/comments.php' );
$cform = ob_get_contents();
ob_end_clean();
return $cform;
} 
  
add_shortcode( 'comments-template', 'comments_template_shortcode' );

How to: Put this code in Toolset > Settings > Custom Code and activate it. Then use comments-template shortcode in your content template.

Support Us via our Affiliate link!

Toolset logo WordPress

What to do next?

Need a Toolset License?

Buy via affiliate link!

Looking for a tutorial?


Help other users – Add your snippet!


Join the discussion!