• Hi

    I’m using the “Popularity Contest” plugin to show the most viewed categories. When i use it as a widget in sidebar, it works fine. But what i need is to use it in the content of the page.

    The plugin is not supported anymore, but it works fine as a widget, and i wonder what function should i call to get the proper output.

    Any ideas please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The plugin by Alex King I presume?

    This should do it, when placed on the template where you want it to appear:
    akpc_show_report('category_popularity');

    If you want it in the actual content of a page, create a shortcode handler that captures the function’s output in an output buffer that is then returned by the handler.

    If you want the report at the very beginning or end of the content, you could insert the buffer output using ‘the_content’ filter instead of a shortcode.

    As you probably know, there is a slew of report types, if ‘category_popularity’ is not right, there are other possibilities. Look through the source code starting around line 1240. Each ‘case’ is a possible report type.

    Thread Starter Jack Johansson

    (@mhmdshv)

    Yes, that worked very nice, thank you. Just one last thing, can i get the link to the category as well? If yes, which part of the PHP file i should modify?

    Thread Starter Jack Johansson

    (@mhmdshv)

    Nevermind, i did it with this piece of code: get_category_link(get_cat_ID($item->name)). Thanks for the assist!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get most viewed categories ( popularity contest )’ is closed to new replies.