Passing parameter to get_comments function
-
I’m trying set the value “post_id” to the ID of the current post and pass it into the get_comments() function. I tried the following but it doesn’t work. Can anybody tell me what I’m doing wrong?
<?php global $post; echo $post->ID; ?>
<?php
$comments = get_comments(‘post_id=$post->ID’);
foreach($comments as $comm) :
echo($comm->comment_author);
echo($comm->comment_date);
echo($comm->comment_content);
endforeach;
?>Thanks in advance!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Passing parameter to get_comments function’ is closed to new replies.