I've try several different loop to display the most viewed post from the last 30 days . . However its just showing the post from 30 dasy ago . . not from the last 30 days . . not the most viewed . . iF anybody can help me out . .it will be fantastic, thank you =)
Here is my loop at the moment:
<ul>
<?php
function filter_where($where = '') {
//posts in the last 30 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts('post_type=post&posts_per_page=3&orderby=post_views_count&order=ASC');
while (have_posts()): the_post(); ?>
<li><div class="tabber-image">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('small-thumb'); ?></a>
</div>
<div class="tabber-text">
<?php
//$meta = get_post_meta(get_the_ID());
//$short_title = $meta['maxmag_featured_headline'][0];
?>
<a href="<?php the_permalink() ?>" class="main-headline"><?php the_title(); ?></a></li>
<?php
endwhile;
wp_reset_query();
?>
</ul>
ANy help would be amazing . .thank you for your time
Aucun commentaire:
Enregistrer un commentaire