简体   繁体   中英

Wordpress comments not showing in single.php

comments not showing in single.php

this is my code in single.php (I have created comments.php and copied the code from default comments.php file theme):

<?php get_header(); ?>


<div class="content-post container">

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

    <p><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> | <?php the_category(', '); ?> | <?php comments_number('No comment', '1 comment', '% comments'); ?></p>

    <?php the_content(); ?>

    <?php wp_list_comments(); ?>



    <?php endwhile; else: ?>

    <h2>Woops...</h2>

    <p>Sorry, no posts we're found.</p>

    <?php endif; ?>

    <p align="center"><?php posts_nav_link(); ?></p>

</div>
<?php get_footer(); ?>

could this be due the css issue? I also installed Disqus plugin and its not displaying

This code looks good. Could be a couple things:

In the admin area, go to the post your viewing and find the "Comments Allowed" checkbox, if your theme allows it.

Try changing the code:

wp_list_comments();

to:

comments_template();

Change it back if that doesn't work.

Don't know what you mean by "css issue". If it's a CSS issue, make some comments, then view the page in a browser. View the page source, and if the comments are set to display:none, you'll still be able to see them in the page source, then you'll know if it's a CSS issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM