Help implementing snippet
-
Regarding the snippet posted here, 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…?
The topic ‘Help implementing snippet’ is closed to new replies.