Title: Help implementing snippet
Last modified: March 3, 2020

---

# Help implementing snippet

 *  Resolved [bufus](https://wordpress.org/support/users/bufus/)
 * (@bufus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/)
 * Regarding the [snippet posted here](https://wordpress.org/support/topic/can-i-get-the-code-snippet-to-display/),
   meant to display the rating on homepage listings, and considering I’m a very 
   poor excuse for a newbie coder, I must ask for help implementing it.
 * My original intention was to place the rating over the featured image, on the
   lower right corner. I think it would look awesome, but I can’t achieve that, 
   too dum :/ (I’m using the Customizr theme, if anyone can give me a pointer, I’d
   appreciate it).
 * That being impossible, I thought I’d make a shortcode to show the rating anywhere
   I’d like inside the content, and if that worked, I’d go for a better approach(
   one step at a time: first a shortcode, then an action hook, and then failure 
   xD).
    This is what my shortcode looks like:
 *     ```
       add_shortcode('rating', 'wppr_rating');
       function wppr_rating(){
           $output = '';
           // get the ID of the post as $post_id
           $review = new WPPR_Review_Model(get_the_ID());
           $rating = $review->get_rating();
           // display the rating icon or use $rating to display a custom icon
           $output .= 'placeholder text ' . wppr_layout_get_rating( $review, 'donut', 'default', array( 'review-wu-grade' ) );
           return $output;
       }
       ```
   
 * Good news, the shortcode works; bad news, the rating donut shows up over the 
   top border of the rating block, and not where I placed it. In fact, no matter
   where I place it, it always shows there.
    What am I doing wrong…?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [contactashish13](https://wordpress.org/support/users/rozroz/)
 * (@rozroz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/#post-12505774)
 * [@bufus](https://wordpress.org/support/users/bufus/) please share a screenshot
   of what the result is and a mockup of what exactly you want to achieve so that
   we can try to help you.
 *  Thread Starter [bufus](https://wordpress.org/support/users/bufus/)
 * (@bufus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/#post-12513969)
 * Sorry for the late reply, I’ve been messing with everything a bit more, and I
   seem to have made it worse :/
    Meanwhile I switched to the block editor (I was
   using classic), and now the shortcode doesn’t work at all, no rating donut anywhere.
   And the visitor rating on the comments look like this: [https://imgur.com/3MVMxfd](https://imgur.com/3MVMxfd)
   Is this a known bug, or have I broken something…?
 * EDIT: on a post made with classic editor, the rating donut shows right before
   the comments -> [https://imgur.com/TcnbN2E](https://imgur.com/TcnbN2E)
 * ANOTHER EDIT: Found it! On a post made with the block editor, but inserting the
   code on single.php, the donut shows right in the middle of the page: [https://imgur.com/undefined](https://imgur.com/undefined)
 * I would like to be able to show a preview of the rating (just the donut) on another
   part of the post (below the title, alongside with some other elements I have 
   there).
    -  This reply was modified 6 years, 3 months ago by [bufus](https://wordpress.org/support/users/bufus/).
    -  This reply was modified 6 years, 3 months ago by [bufus](https://wordpress.org/support/users/bufus/).
    -  This reply was modified 6 years, 3 months ago by [bufus](https://wordpress.org/support/users/bufus/).
 *  Plugin Contributor [contactashish13](https://wordpress.org/support/users/rozroz/)
 * (@rozroz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/#post-12522415)
 * [@bufus](https://wordpress.org/support/users/bufus/) it might be best to state
   your problem statement again because this thread has become very confusing.
 *  Thread Starter [bufus](https://wordpress.org/support/users/bufus/)
 * (@bufus)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/#post-12522939)
 * Thanks, [@rozroz](https://wordpress.org/support/users/rozroz/) , I understand.
   
   I’ll open another one and try to be clearer about the issue.
 *  Plugin Contributor [contactashish13](https://wordpress.org/support/users/rozroz/)
 * (@rozroz)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/#post-12530386)
 * Thanks [@bufus](https://wordpress.org/support/users/bufus/). I’m closing this
   thread till then.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Help implementing snippet’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-product-review_7b97d5.svg)
 * [WP Product Review Lite](https://wordpress.org/plugins/wp-product-review/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-product-review/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-product-review/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-product-review/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-product-review/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-product-review/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [contactashish13](https://wordpress.org/support/users/rozroz/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/help-implementing-snippet/#post-12530386)
 * Status: resolved