Wordpress website widget Code help!

2 replies
hey guys i recently ordered this gig on fiverr asking for my trending widgets to show the most viewed posts over a 7 days period dorting from most viewed to least viewed, however the programmer did not quite do what i asked. Instead the person is only making the widgets show posts that are less than seven day.

how can i fix this code to make the widget display what i want?

Please See My site the code is for the 3 trending widgets videos,music and news. if you know in the news section a post is missing because posts older than 7 days are nor shown Websie-> Yard hype

fiverr gig result:


<?php


//------ Added by Ganesh -----------------
function filter_where($where = '')
{
//posts in the last 7 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
//------ End by Ganesh -----------------
query_posts('showposts=5 & category_name=videos');

?>







<?php while (have_posts()) : the_post(); ?>



<li>



<div class="boxtitle"><a href="<?php the_permalink(); ?>"><p><?php limit_title($post->post_title, 40); ?></p></a></div>



<div class="boxauthor"><p><?php the_author(); ?>&nbsp;&nbsp;<span class="hoursago"><?php the_time(); ?><p></div>



</li>



<?php endwhile;?>



<?php wp_reset_query(); ?>



</ul>



</div>







<div id="trendingmusic" class="colorboxes">



<div class="boxname"><h3>Yard Hype's Trending Music</h3></div>



<ul>



<?php



//------ Added by Ganesh -----------------
add_filter('posts_where', 'filter_where');
//------ End by Ganesh -----------------

query_posts('showposts=5 & category_name=music');


?>







<?php while (have_posts()) : the_post(); ?>



<li>



<div class="boxtitle"><a href="<?php the_permalink(); ?>"><p><?php limit_title($post->post_title, 40); ?></p></a></div>



<div class="boxauthor"><p><?php the_author(); ?>&nbsp;&nbsp;<span class="hoursago"><?php the_time(); ?></span><p></div>



</li>



<?php endwhile;?>



<?php wp_reset_query(); ?>



</ul>



</div>







<div id="trendingnews" class="colorboxes">



<div class="boxname"><h3>Yard Hype's Trending News</h3></div>



<ul>



<?php



//------ Added by Ganesh -----------------
add_filter('posts_where', 'filter_where');
//------ End by Ganesh -----------------

query_posts('showposts=5 & category_name=News');

?>







<?php while (have_posts()) : the_post(); ?>



<li>



<div class="boxtitle"><a href="<?php the_permalink(); ?>"><p><?php limit_title($post->post_title, 40); ?></p></a></div>



<div class="boxauthor"><p><?php the_author(); ?>&nbsp;&nbsp;<span class="hoursago"><?php the_time(); ?><p></div>



</li>



<?php endwhile;?>



<?php wp_reset_query(); ?>



</ul>



</div>



</div> <!-- #videoaudionews -->
#code #header #website #widget #wordpress
  • Profile picture of the author Big Squid
    You're going to need some sort of tracking to determine which is most viewed...


    I suggest the easiest thing to do is put a little php at the top of your pages to submit to a database each time the page is loaded. It's a little rough, but it'll do the job.

    If you need help with this, please let me know...
    {{ DiscussionBoard.errors[5998632].message }}
  • Profile picture of the author nicolas simpson
    Yes i need you help.i PM you
    Signature
    Discover Reggae | Dancehall [Jamaica]
    {{ DiscussionBoard.errors[5998686].message }}

Trending Topics