Support » Plugins and Hacks » Top 10 - Popular posts plugin for WordPress » [Plugin: Top 10] Patch: Option to specify the number of top posts manually

  • Daedalon

    (@daedalon)


    This patch allows to specify the number of top posts when calling tptn_show_pop_posts() or tptn_show_daily_pop_posts() manually. Usage example: if(function_exists('tptn_show_pop_posts')) tptn_show_pop_posts(12);

    1.1. In top-10.php near line 110 find the line function tptn_pop_posts( $daily = false , $widget = false ) { and replace it with function tptn_pop_posts( $daily = false, $widget = false, $posts = 0 ) {

    1.2. Near line 115 find the line $limit = $tptn_settings['limit']*5; and replace it with if ($posts>0) $limit = $posts*5; else $limit = $tptn_settings['limit']*5;

    1.3. Near line 214 find

    function tptn_show_pop_posts() {
    echo tptn_pop_posts(false,false);
    }

    // Function to show daily popular posts
    function tptn_show_daily_pop_posts() {
    global $tptn_url;
    $tptn_settings = tptn_read_options();
    if ($tptn_settings[‘d_use_js’]) {
    echo ‘<script type=”text/javascript” src=”‘.$tptn_url.’/top-10-daily.js.php?widget=1″></script>’;
    } else {
    echo tptn_pop_posts(true,false);

    and replace it with

    function tptn_show_pop_posts($posts=0) {
    echo tptn_pop_posts(false,false,$posts);
    }

    // Function to show daily popular posts
    function tptn_show_daily_pop_posts($posts=0) {
    global $tptn_url;
    $tptn_settings = tptn_read_options();
    if ($tptn_settings[‘d_use_js’]) {
    echo ‘<script type=”text/javascript” src=”‘.$tptn_url.’/top-10-daily.js.php?widget=1″></script>’;
    } else {
    echo tptn_pop_posts(true,false,$posts);

    Future shortcodes can use this straight. The only things missing are the handler functions and the add_shortcode() calls.

    http://wordpress.org/extend/plugins/top-10/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Daedalon

    (@daedalon)


    Ajay: Would you incorporate the above patch? I’m looking forward to skip 1.8 and try 1.8.1 if you’d add the above. This way I don’t have to repatch 1.8 then later test 1.8.1 separately whether it breaks things that are dependant on my patches.

    By the way, the plugin page linked on the Plugin meta contains a changelog that ends at 1.7.5.

    You got some nice content on the site. Already shared many with friends.

    Hi from down under:
    I have contacted you after a fruitless search for a solution to Top 10 plugin problem.
    I have installed the plugin. It shows the counts on pages and individual posts but no posts show in side bar list. I activated showing pages and a link to author and they now show but not the posts.
    Would appreciate any help you can give.
    Blog http://www.stephenpowell.com.au/wordpress/

    Thanks in anticipation.
    Steve

    Plugin Author Ajay

    (@ajay)


    @daedalon, Missed this post before I released v1.8.1. I’ll put this in v1.8.2

    Nothing major has changed in v1.8.1

    Thank you for your reply. The post counts appeared in the side bar the following day. I have updated to the new version. Thank you again

    Stephen Powell

    Plugin Author Ajay

    (@ajay)


    @stephen, you’re welcome. It’s all working fine now, right?

    Working perfectly:
    The plugin worked perfectly from installation. I was just not aware of the delay between installation and all counts appearing on page. On checking the page the following day all counts were visible. Good app! App and support much appreciated.
    Thanks again.

    Steve

    Plugin Author Ajay

    (@ajay)


    Thank you for using my plugin 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Top 10] Patch: Option to specify the number of top posts manually’ is closed to new replies.