Trying to get comments for a post, but I can’t get it to work. Here’s the code: <?php
$comments = get_comments('$post_id');
foreach($comments as $comment) : ?>
<div>
<ul>
<li>
<?php echo ($comment->comment_content); ?>
</li>
</ul>
</div>
<?php endforeach; ?>
I see you have quotes around the $post_id varible. Remove them, and if it still doesn’t work, do a var_dump on your $post_id varible.
Perhaps its null or something.
Mitchelle
Trying to get comments for a post, but I can’t get it to work. Here’s the code:
<?php
$comments = get_comments('$post_id');
foreach($comments as $comment) : ?>
<div>
<ul>
<li>
<?php echo ($comment->comment_content); ?>
</li>
</ul>
</div>
<?php endforeach; ?>