I am creating a small listing of recent comments, and want to make links towards the actual posts the comments were positioned on. Regrettably, there's no comment_permalink or post_permalink will be able to find, and so i thought maybe there will be a get_permalink() function, however, none which i may find on http://codex.wordpress.org/Function_Reference/.

In the $post->ID alone, how do i discover the permalink for your particular publish? Not too it's totally necessary, but here's what I've to date:

<?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 would be to convert the $parent->post_title right into a permalink.

I figured maybe there will be a get_permalink() function, however, none which i may find.

http://codex.wordpress.org/Function_Reference/get_permalink

I'd also recommend by using their over get_page_link()

get_permalink() inspections the publish type and returns caused by the right function

  • Pages use get_page_link()
  • Accessories use get_attachment_link()
  • Custom publish types use get_post_permalink()

The confusion comes consequently of ambiguous function names. I had been searching for something which recommended a hyperlink for any "publish," yet found nothing. From curiousity, I discovered and examined [cde], only to discover it does precisely what I had been searching for.

Regrettably I believed that "page" was a unique term restricted to pages in wordpress, instead of posts. It seems within this context it's associated with both.