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 Hack

Get Recent Comments Plugin Hack