I'm building a small list of recent comments, and would like to make links to the actual posts that the comments were placed on. Unfortunately, there is no comment_permalink
or post_permalink
that I can find, so I thought maybe there would be a get_permalink()
function, but again, none that I could find on http://codex.wordpress.org/Function_Reference/.
From the $post->ID
alone, how can I find the permalink for that particular post? Not that it's completely necessary, but here is what I have so far:
<?php $comments = get_comments( array( 'status'=>'approve', 'number'=>5 ) ); ?>
<p class="recently-posted-comments">Recent Comments</p>
<ul>
<?php foreach ($comments as $comment): $parent = get_post($comment->comment_post_ID); ?>
<li><?php print $comment->comment_author; ?>
on <?php print $parent->post_title; ?></li>
<?php endforeach; ?>
</ul>
My intent is to convert the $parent->post_title
into a permalink.