[Plugin: Top 10] Patch: Option to specify the number of top posts manually
-
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 withfunction 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 withif ($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.
- The topic ‘[Plugin: Top 10] Patch: Option to specify the number of top posts manually’ is closed to new replies.