Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Highest rated post of the week - WP-PostRatings/timthumb WordPress

  • SOLVED

Hello,
I have 2 spots for highest rated of the week posts thumbnail at the top right of my site.
The problem is that those spots are showing the highest rated of all time instead of the highest of the past week.
The rating is correct in showing the highest rated and thumbs just not the time span(7 days rolling).

Timthumb is also used for other areas of the site with different thumb sizes.
wp-postratings readme
http://lesterchan.net/wordpress/readme/wp-postratings.html
(look under usage tab for various usage codes)

The code I have placed at this time.
<ul>
<?php if (function_exists('get_highest_rated')): ?>
<?php query_posts($query_string.'&r_sortby=highest_rated&range=7&r_orderby=desc&posts_per_page=2') ?>
<?php while(have_posts()) : the_post(); ?>
<li>
<div class="date"><?php the_time('F jS, Y') ?></div>
<h4><?php the_title(); ?>
<a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo catch_that_image() ?>&w=180&h=100&zc=1" alt="<?php the_title(); ?>" /></a></h4>
</li>
<?php endwhile; ?>
<?php endif; ?>
</ul>

Answers (2)

2012-06-15

Arnav Joy answers:

replace query post with the following

<?php query_posts($query_string.'&r_sortby=highest_rated&range=7&r_orderby=desc&posts_per_page=2&w='.date('W')) ?>


ajay300 comments:

This is what I have placed now.
It narrowed the range and placed the highest rated(5 stars) above the next highest rated which is also most recent post(4 stars).

-unrelated to this answer-
I have a post I wanted to test but for some reason it wont allow to be rated. The stars are there but when I hover over it wont allow me to click/rate it.

I'm going to go with this code as it seems to work the best and its what I was fully looking for.

Thanks Arnav Joy


Arnav Joy comments:

If you need any help then please tell me , I will be happy to see it .

Also if everything is ok then please vote for me.

2012-06-15

Romel Apuya answers:

have you tried the

get_highest_rated_range?



Romel Apuya comments:

<?php if (function_exists('get_highest_rated_range')): ?>
<ul>
<?php query_posts($query_string.'&r_sortby=highest_rated&range=7&r_orderby=desc&posts_per_page=2') ?>
<?php while(have_posts()) : the_post(); ?>

<li>

<div class="date"><?php the_time('F jS, Y') ?></div>

<h4>
<?php the_title(); ?>

<a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
<img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo catch_that_image() ?>&w=180&h=100&zc=1" alt="<?php the_title(); ?>" />
</a>
</h4>

</li>

<?php endwhile; ?>
</ul>
<?php endif; ?>


ajay300 comments:

Worked in a way that it narrowed the timeline to 7 days but the highest rated wasnt placed at the top of the 2 post/thumbs. How I missed trying this before I'm unsure.