Support » Plugin: Author Post Ratings » insert star rating in the sidebar?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Philip Newcomer

    (@philipnewcomer)

    Hi, the template tags which are available for use are described here: https://philipnewcomer.net/wordpress-plugins/author-post-ratings/

    Thread Starter jordianis

    (@jordianis)

    Thanks allot Phillip for the quick reply, since I really don´t know what I´m doing, would I use this code to add it in my home page where I have the sidebar that displays the post?

    $rating = get_post_meta( get_the_ID(), ‘_pn_apr_rating’, true );

    One thing though! the post that I will display in the sidebar has a rating already, all I want to do is take the rating from the article and display it in the home page just like this sample

    http://www.apennyshaved.com,

    thanks for the reply

    Plugin Author Philip Newcomer

    (@philipnewcomer)

    The template tag will simply display the rating for the current post. You would need to integrate it into the widget code, or create your own widget that utilizes the template tag.

    Thread Starter jordianis

    (@jordianis)

    thanks for the quick reply, wow im really sorry about this, but Im still confused! if what i read is correct, with this code:

    $rating = get_post_meta( get_the_ID(), ‘_pn_apr_rating’, true );

    I integrate it to the widget that displays my recent posts and I will be able to display the rating for that current article, is this correct?

    Sorry for bouncing back and forth, I really appreciate it.

    Plugin Author Philip Newcomer

    (@philipnewcomer)

    Here’s the relevant content from the plugin page:

    You can use get_author_post_rating( $post_id ) and the_author_post_rating( $post_id ) in your templates. Passing the post ID is optional, if you don’t include it the plugin will use get_the_ID() to try and figure it out for itself. You can pass the current post ID, or the ID of another post if you wish.

    get_author_post_rating() will return the numeric post rating, if the post has one. This value does not include the HTML markup or star images which would surround the post rating on a normal post, it just returns the rating value itself.

    the_author_post_rating() will echo the post rating along with the label and star images. Optionally, you can set the second parameter to true to return the markup instead of echoing it, like this:
    $rating_markup = the_author_post_rating( $post_ID, true );

    In your case you’d want to use the the_author_post_rating() function, which will actually display the rating along with the label and stars, instead of just getting the post meta rating value with the get_post_meta() function.

    is this the plugin built into the Splash theme for reviews? The star ratings?

    Hi Phillip,

    I love the work you are doing to better the WordPress community. Thank you. I have a site http://www.besthomeicecreammaker.com that I would like to use the star rating on.

    I was also wondering if this is built into any themes for reviews.

    Thanks again.

    Do you mean a rating system like this one? http://www.shaversandrazors.com/

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘insert star rating in the sidebar?’ is closed to new replies.