How to use Category Icons with Get Recent Comments WordPress plugin

Well, this is a kind of a hack of Krischan Jodies’s popular plugin : Get Recent Comments. Just before this line of code :

$output = str_replace("%comment_link",    $comment_link,     $output);

add these lines :

if (function_exists("get_cat_icon")) {
$output = str_replace( "%post_icon", get_cat_icon("cat=".$post->term_taxonomy_id."&echo=0&link=false"), $output);
}

%post_icon will then display the category icon of the post. To be more precise, it’ll display the LAST category icon if the post belongs to several categories, as in Kristian’s code, $post->term_taxonomy_id contains the last category found in the database.

So, if you go to Recent Comments > Comments, and you enter %post_icon in “Group comments by Posting”, the category icons will be displayed :

Get Recent Comments Plugin WP Development Lab 450x390 How to use Category Icons with Get Recent Comments WordPress plugin

Get Recent Comments Plugin Hack

If you enjoyed this post, make sure you subscribe to my RSS feed!

2 thoughts on “How to use Category Icons with Get Recent Comments WordPress plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>