If this is your first time visiting, be sure to subscribe to my RSS Feed, and don't forget to follow me on Twitter! If it isn't your first time here and you're sick and tired of this message, get rid of it.

Apr 29

Filed Away: Plugins, WordPress

WP Specific Comment

Just recently, I built a site called OMG!Hungry! which used WordPress in an unusual way to perform its purpose. One of the things I needed this site to do was to link directly to (and display) only one specific comment via a permalink. Since (at the time of writing) there were no other plugins available to help me do this, I decided to write [my first] one.

Thanks to this book and the help of my friend Nick Ohrn, I happily release WP Specific Comment.


WP Specific Comment provides a template tag for use anywhere in your theme, inside or outside The Loop. This template tag will return a comment as an object, from which you can retrieve any standard comment data. To initiate the plugin, place <?php wp_specific_comment($ID); ?> into your theme, where $ID will be the ID number for the comment you want returned.


<?php wp_specific_comment(44); ?> will return the comment with the ID of 44. Pretty simple, right?

Note: This template tag will not actually display anything. It only sets up a comment to be displayed. You’ll have to add in some other standard WordPress Template Tags to get anything to show up on your blog. List of available Comment Tags can be found here.

Example Usage:

     <?php wp_specific_comment(1); ?>
     <h5 class="comment_author"><?php comment_author_link(); ?></h5>
     <div class="comment_text"><?php comment_text(); ?></div>

The above code would retrieve comment with ID of 1, and then display its author (linked to the author’s URL, if provided) in a <h5> followed by a <div> containing the comment’s text content. Still pretty simple!


Installation of WP Specific Comment is quick and easy.

  1. Upload wp-specific-comment.php to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Place <?php wp_specific_comment($ID); ?> in your templates, where $ID is will be the numerical ID for the comment you want returned.
  4. Add additional WordPress Comment Tags to display the desired data.


Click Here

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /homepages/20/d210624833/htdocs/upsidestudio/wp-content/themes/upsidestudio/single.php on line 54

Warning: file_get_contents(http://tinyurl.com/api-create.php?url=http%3A%2F%2Fupsidestudio.com%2Fwordpress%2Fwp-specific-comment%2F) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /homepages/20/d210624833/htdocs/upsidestudio/wp-content/themes/upsidestudio/single.php on line 54
Tweet This

Tagged: , , , , , ,

3 comments so far on this post:

  1. Nick |

    Nice plugin! I love it.

  2. baron |

    Works great, thank you

  3. Lasha |

    Great plugin! This may come in handy in the near future. :)

Got something to say?