Custom comments.php not working for me
-
I know I am reposting this but something weird happened with my last post and I got a “topic closed” when I try to edit or add anything to it!!
Hi there, I’m trying to create my own theme from scratch and I’m up to the comments part, I can’t seem to display the comments properly but everything else works ok, this is my code:
<div id="comments" class="postComments"> <h2><?php comments_number('No Comments', '1 Comment', '% Comments'); ?>.</h2> <?php if ( have_comments() ) : ?> <!--https://net.tutsplus.com/tutorials/wordpress/unraveling-the-secrets-of-wordpress-commentsphp-file/--> <ol class="commentList"> <?php wp_list_comments('type=comment'); ?> </ol> <div class="navigation"> <p class="older"><?php previous_comments_link('Older comments') ?></p> <p class="newer"><?php next_comments_link('Newer comments') ?></p> </div> <?php endif; // end have_comments() ?> </div>
Also would like to mention this also did not work for me:
<?php if($comments) : ?> <ol class="commentList"> <?php foreach($comments as $comment) : ?> <li id="comment-<?php comment_ID(); ?>"> <?php if ($comment->comment_approved == '0') : ?> <p>Your comment is awaiting approval</p> <?php endif; ?> <?php comment_text(); ?> <cite><?php comment_type(); ?> by <?php comment_author_link(); ?> on <?php comment_date(); ?> at <?php comment_time(); ?></cite> </li> <?php endforeach; ?> </ol> <?php else : ?> <p>No comments yet</p> <?php endif; ?>
I have two comments there but none are appearing and the part that displays the comment count displays 2, am I missing a function in the functions.php file? Because this file is near empty save for a few widget based functions.
Note when I am using twentyten the comments are appearing just fine.
Hope someone can help!
- The topic ‘Custom comments.php not working for me’ is closed to new replies.