Home > How to > How to use Category Icons with Get Recent Comments WordPress plugin

How to use Category Icons with Get Recent Comments WordPress plugin

August 19th, 2009 Sub Leave a comment Go to comments

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

If you enjoyed this post, make sure you subscribe to my RSS feed!
Categories: How to Tags: ,
  1. December 15th, 2009 at 21:30 | #1

    Greetings Well I finally did it – replied on your blog that is

  2. February 2nd, 2010 at 13:11 | #2

    Yeah thanks for sharing, not that easy to follow at the beginning, but it looks working now, so thanks again.

    Max

  1. No trackbacks yet.