WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
[resolved] How to display 'top post' lists (10 posts)

  1. ted_the_bad
    Member
    Posted 1 year ago #

    Great plugin! I need a bit of help figuring out how to show show 3 different 'top posts' lists though. I'm not using widgets so I'm looking to add the code directly into my theme files:

    1 - Top 5 posts of the week.
    I've already got this one partially working using the function below. Currently it just shows the post title and number of votes received for each one. Is there any way to show the rating stars and rating text in addition and sort them highest to lowest?
    get_highest_score_range('7 days','post',5);

    2 - Top 5 posts of the week by tag.
    Same as above except I want to list the top 5 posts for a specific tag (e.g. football posts tagged 'Arsenal').

    3 - Top 5 rated categories
    This needs to list the top 5 categories by their average post ratings, highest to lowest.

    Can this be achieved using the 'expand_ratings_template'? I've seen it mentioned here but haven't seen any documentation on how to use it.

    Thanks for any help you can offer!

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

  2. ted_the_bad
    Member
    Posted 1 year ago #

    Okay, so far I've achieved the first one by creating a new function based on get_highest_score_range() and changing the output in wp-postratings.php to look like I wanted.

    Number 2 and 3 are a lot more complicated and require SQL skills which I'm currently attempting to learn but its a bit above my current level!

  3. a148
    Member
    Posted 1 year ago #

    I have a questoin that how to fetch the post image of the top rated post
    I have use the

    any help
    and thanks in advance.

  4. BPweba
    Member
    Posted 1 year ago #

    hellow

    I have the same question as a148, how to fetch post img with ratings :$

  5. Lester Chan
    Member
    Plugin Author

    Posted 1 year ago #

    I will not provide details on customization, but I can provide tips.

    1. Study http://codex.wordpress.org/Template_Tags/query_posts
    2. Use<?php query_posts($query_string.'&r_sortby=highest_rated&r_orderby=desc') ?>

  6. BPweba
    Member
    Posted 1 year ago #

    Thank you very much ;)

  7. Jive Dig
    Member
    Posted 1 year ago #

    Hey ted_the_bad,

    Any interest in sharing how you got sorting to work? I just want to create pages based on their ratings. eg: 5 star posts, 4 star posts, etc...

    I'm using this with WooCommerce so it'd basically be sorting the top rated products. I'll throw some cash your way for some help!

  8. ted_the_bad
    Member
    Posted 1 year ago #

    I ended up editing the postratings-stats.php file to include some additional functions of my own (based on the existing ones) that would output the results of my custom SQL queries. I then executed those functions in my theme template where I wanted the posts to appear.

  9. sofiafranzen
    Member
    Posted 1 year ago #

    I still don't get it.
    Where and how am i supposed to insert my category-id here;

    <?php if (function_exists('get_highest_score_category')): ?>
    
    <ul>
            <?php get_highest_score_category(CATEGORY_ID); ?>
        </ul>
    <?php endif; ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum's parser.]

  10. georgypoplavsky
    Member
    Posted 1 year ago #

    Did not understand anything, so how to make a separate page rankings?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic