Support » Plugin: Advanced Most Recent Posts Mod » [Plugin: Advanced Most Recent Posts Mod] Problems getting current category

  • Hi,

    I’m using the Advanced Most Recent Posts Md Plugin for quite a while.
    I use it to have a list of recent posts on a sidebar, restricted to the current category.

    Recently, I noticed that the feature of restricting to the current category when viewing a single post started producing erratic results.

    After quite a while of troubleshooting I understood what0s going on..but I’m lacking some simple way to solve it.

    So, in the same sidebar I’m using to show advanced recent posts, I’m showing some “featured posts” (posts belong to a special category).
    These “featured posts” are shown above (that is before..) the advanced recent posts.

    What’s happening is that when this plugin tries to get the current category, it gets the category of the last post displayed on the “featured posts” section and not of the post being shown.

    I’ve read through the manuals and located the relevnat code section…but whatever I do I always get ID’s, categories, etc..related to last posts shown on “featured posts” section.

    How do I work around this? How can I ensure that the advanced recent posts gets the main post being displayed and not the last one from some peevious query?

    Any help would be much appreciated.


Viewing 1 replies (of 1 total)
  • Thread Starter migueleste


    Well, maybe nobody is reading this… but in case you get the same problem, my solution was, to change the call to get_the_category().
    After the change it looks like this (changes in bold)

    if (($actcat) && (is_single())) {
    global $wp_query;
    $cats = ”;
    foreach (get_the_category($wp_query->post->ID) as $catt) {
    $cats .= $catt->cat_ID.’ ‘;
    $cats = str_replace(” “, “,”, trim($cats));


Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Advanced Most Recent Posts Mod] Problems getting current category’ is closed to new replies.