• Resolved jardokraka

    (@jardokraka)


    What I am trying to achieve is list 10 highest rated posts from the last, say, 30 days.

    According to the FAQ, I should use

    <?php get_highest_rated_range('30 days', 'post', 10); ?>

    The issue is with the range — the plugin lists the posts (seemingly) based on the date when they were rated (rating timestamp?), while I need the criteria to be the post date.

    If at all possible, I would also like to further limit the selection to a minimum of, say, 5 votes.

    Any help would be greatly appreciated.

    http://wordpress.org/plugins/wp-postratings/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Lester Chan

    (@gamerz)

    That feature is not in the plugin and even using WordPress query_post() you will not be able to get Last X Days of post.

    You basically have to write your own query to archive that.

    I would recommend checking out get_highest_rated() function in postratings-stats.php and perhaps adding a $wpdb->posts.post_date >= ( CURDATE() - INTERVAL 5 DAY ) to the end of the query.

    Thread Starter jardokraka

    (@jardokraka)

    Thank you very much for your help, I was able to achieve what I wanted.

    Is there a way I could preserve the newly created function somehow? For now I added it directly to postratings-stats.php, but this file will be overwritten when the plugin is updated.

    Plugin Author Lester Chan

    (@gamerz)

    You can put it in your theme’s functions.php if there is one, if not you can create the file and put the function there

    Thread Starter jardokraka

    (@jardokraka)

    Excellent. I had thought about adding the function to functions.txt, just wanted to make sure first it was the right thing to do. Again, thank you for your help, I will probably come back in a few days with more questions 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘'Get highest rated range' issue’ is closed to new replies.