How toHow 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

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

  1. Recently I have seen this recent comments column on many blogs and was just wondering how this was possible, I was just thinking that this was because of a module and thought that it is possible only by enabling that module, but now I have got a alternative for that. Thanks for sharing this information…