[Plugin: WordPress Popular Posts] Changing output based on daily, weekly, and monthly
-
HI,
I am using the php code template tags for wpp.
I need a slight change in the output for the daily output vs the weekly output vs the monthly output.
I have each of those outputs showing up in a different div that display as different tabs with jquery ui tabs.
<div id="daily"><?php if (function_exists('wpp_get_mostpopular')) wpp_get_mostpopular("range=daily&limit=3&pages=0&thumbnail_selection=usergenerated&thumbnail_height=139&thumbnail_width=182&wpp_start=<ol>&wpp_end=</ol>&do_pattern=1&pattern_form={title}{posttime}"); ?></div>'
<div id="weekly"><?php if (function_exists('wpp_get_mostpopular')) wpp_get_mostpopular("range=weekly&limit=3&pages=0&thumbnail_selection=usergenerated&thumbnail_height=139&thumbnail_width=182&wpp_start= <ol>&wpp_end=</ol>&do_pattern=1&pattern_form={title}{posttime}"); ?></div>'
<div id="monthly"><?php if (function_exists('wpp_get_mostpopular')) wpp_get_mostpopular("range=monthly&limit=3&pages=0&thumbnail_selection=usergenerated&thumbnail_height=139&thumbnail_width=182&wpp_start=<ol>&wpp_end=</ol>&do_pattern=1&pattern_form={title}{posttime}"); ?></div>'
I have modified the $data variable in wpp to include the custom values I want as shown below.
$data = array( 'title' => '<a>ID).'" title="'. $title_attr .'" onMouseOver="setpage(\'thumb1', \''.get_permalink($wppost->ID).'\', \''.get_video_thumbnail($wppost->ID).'\')"><span class="wpp-post-title">'. $tit .'</span></a>', 'summary' => $post_content, 'stats' => $stats, 'img' => $thumb, 'id' => $wppost->ID, 'posttime' => '<span class="wpp-post-time"> (\''.get_field('video_time', $wppost->ID).'\')</span>'
This $data output works fine for daily div. But for weekly div, I need the line
“setpage(\’thumb1′, \” to be “setpage(\’thumb2′, \” and for monthly div I need it to be “setpage(\’thumb3′, \”.This is to allow for the thumbnail of the post to show up in the proper div when someone mouseovers the post.
So I figure I have two options.
One is to create two new $data variables called $weeklydata and $monthlydata which would have new values assigned in the array.
I tried setting them but not sure where all they would need to go to work.
Secondly, I thought of changing the line
"setpage(\'thumb1', \ to "setpage(\'thumb' .$thumbnumber.'\',
Basically I need for the first three iterations of $data (since I have three posts per div) to have $thumbnumber=1, then the next three iterations $thumbnumber=2 and then last three $thumbnumber=3.
Someone helped me create code to do this below, but with this code it just sets the $thumbnumber to 3 for all nine iterations.
So i tried including the whole $data array in the for statement below, but it didn’t make a difference.
for($i = 1; $i <= 9; $i++) { $thumbnumber = ceil($i/3); $thumbnumber = ($thumbnumber > 3) ? 3 : $thumbnumber; }
I know this is complicated, but help would be appreciated, I am stuck on this one.
http://wordpress.org/extend/plugins/wordpress-popular-posts/
- The topic ‘[Plugin: WordPress Popular Posts] Changing output based on daily, weekly, and monthly’ is closed to new replies.