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?
Wordpress website widget Code help!
3
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(); ?> <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(); ?> <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(); ?> <span class="hoursago"><?php the_time(); ?><p></div>
</li>
<?php endwhile;?>
<?php wp_reset_query(); ?>
</ul>
</div>
</div> <!-- #videoaudionews -->
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(); ?> <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(); ?> <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(); ?> <span class="hoursago"><?php the_time(); ?><p></div>
</li>
<?php endwhile;?>
<?php wp_reset_query(); ?>
</ul>
</div>
</div> <!-- #videoaudionews -->
- Big Squid
- nicolas simpson
Next Topics on Trending Feed
-
3