How to add the Popularity Contest plugin to a Thesis themed wordpress site

In a previous post I talked about how to make the Popularity Contest plug-in work with WordPress > 2.6. This post will discuss how easy it is to add it to a Thesis theme using a widget.

This post assumes that you already have followed the previous post and have a working Popularity Contest plug-in.

Since Thesis uses some very handy hooks all you will need to do is add the following to your custom_functions.php This code will add an unordered list to sidebar1.

/* This is popular posts */
function custom_popular_posts() { ?>
<?php if (function_exists('akpc_most_popular')) { 
echo ('<li class="widget"><h3>Most Popular Posts</h3>');
echo ('<ul>');
    akpc_most_popular(); 
echo ('</ul></li>');
} ?>
<?php } 
add_action('thesis_hook_before_sidebar_1', 'custom_popular_posts', '');

Since this uses the ‘widget’ class no further styling is needed. Wasn’t that easy?

If this post was helpful, How about posting a link to your site?

Popularity: 61% [?]

Comments

  1. chlankboot says:

    Yeah, nice post, i inspired from your code to use it with ‘Google News’ plugin. I just wonder if it is possible to wrap the News inside a note (), tried but seems not working.
    Thanks anyway for the great tip.

  2. chlankboot says:

    Sorry, my site is The Chlankboot Journal

Speak Your Mind