PHP noob..need help displaying comment ID
-
I am trying to display the ID of each comment of every post on a category page.
When I hard code a ‘post_id’ it works as intended:
<?php $comments = get_comments('post_id=32'); foreach($comments as $comment) : echo($comment->comment_ID); endforeach; ?>
However when I try to dynamically set the ‘post_id’ it doesn’t work right:
<?php $idx = the_ID(); $comments = get_comments('post_id=$idx'); foreach($comments as $comment) : echo($comment->comment_ID); endforeach; ?>
Any ideas? Is
get_comments('post_id=$idx')
written incorrectly?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP noob..need help displaying comment ID’ is closed to new replies.