WordPress Plugins > WP-PostViews

Showing top posts from x days

(1/1)

dekap:
i am trying to show only the top viewed posts for the past 7 days but i am having trouble getting the code working. can someone help me with this? so far my code looks like:

<?php if (function_exists('get_most_viewed')): ?>
<?php $today = getdate(); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('v_sortby=views&amp;v_orderby=desc&showposts=2&year=$today[year]&monthnum=$today[mon]&day=$today[mday]&paged=$paged') ?>
<?php while (have_posts()) : the_post(); ?>
<div id="topviewed"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php
   if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) {
      the_post_thumbnail('thumbnail'); } ?></a>
<?php the_title(); ?>
</div><?php endwhile; endif; ?>
<?php wp_reset_query(); ?>

the problem with this code is that instead of the top viewed posts in the last 7 days, it shows all top viewed posts. where did i go wrong?

Navigation

[0] Message Index

Go to full version