3

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

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

0

I am using

comments_template('/single-comment.php');

single-comment.php is the file that contains all the content from comment.php. You can later edit this (single-comment.php) file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.