Need Help with the function of a WP widget!!
See the widgets in my site here: Yardhype
This was the original code:
<ul>
<?php 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>
how can i fix this code to make the widget display what i want?
which is the most viewed pots.
At the moment the fiverr gig result: code below is causing posts that are older than 7 days to disappear from the widget
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>
I am willing to pay if its not a simple fix.
Thank You