I cant get the comments template to show up in my single-events.php

This is my code

<?php while ( have_posts() ) : the_post(); ?>   
<?php get_template_part( 'content', 'events' ); ?>
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>

If I put the comments template in my events template (events.php), it will show up but it doesnt work on the single posts.

Any ideas anyone?

2 Answers
2

Here’s 2 solutions i tested:

Try adding support for comments in your custom post type code

'supports' => array(  'comments' ),

You could also use add_post_type_support

add_action('init', 'wpsites_comments');
function wpsites_comments() {
    add_post_type_support( 'events', 'comments' );
}

Code Source

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *