WordPress.org

Forums

$comments stays empty (1 post)

  1. TNLNYC
    Member
    Posted 8 years ago #

    I've hacked my own theme (http://www.tnl.net/blog ) but one thing doesn't seem to work: comments.

    Basically, comments are published (they show up in the DB) but I don't seem able to retrieve them. I get a comment count no problem but when I try to initialize an array to create comments it's a no-go.. Here's the code I have in comments.php:

    $post_id = $post->ID;
    $comments = get_approved_comments($post_id);
    if ($comments) :
    print comments_number('No Responses', 'One Response', '% Responses' );

    foreach ($comments as $comment) :
    print "<div class=\"entry\">".chr(13)."<h3></h3>";
    print "<p class=\"desc\" id=\"comment-".comment_ID()."\">".comment_text()."".chr(13);
    print "<p class=\"meta\">".comment_type("Comment", "Trackback", "Pingback")." by ".comment_author_link().comment_date()." @ ".comment_time()."".edit_comment_link("Edit This", " • ")."</div>".chr(13);
    endforeach;
    else:
    print "No comments at this time";
    endif

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.