wp-postratings icon indicating copy to clipboard operation
wp-postratings copied to clipboard

Using a shortcode in a query loop results in incorrect display.

Open beckej13820 opened this issue 11 months ago • 2 comments

WIth Full Site Editing themes like the WordPress default theme Twenty Twenty-Four, it would be nice to be able to use this plugin inside query loops.

When I attempted to do this, I got buggy behavior, in that all posts on the archive page show the value of the first post displayed.

Here's my setup so that you can try to reproduce it:

On my archive page, I have a query loop. Inside the query loop, I use the shortcode method to include display the ratings: Screenshot 2024-03-03 at 4 31 40 PM

This creates a display. As noted above, please note that the rating count is incorrectly displayed as the same for all three posts. Screenshot 2024-03-03 at 4 34 58 PM

Please note that the second post on the list shows a different number when viewed on a post page. The post page is the correct value.

Screenshot 2024-03-03 at 4 35 15 PM

beckej13820 avatar Mar 03 '24 21:03 beckej13820

Same thing, how did you solve this problem?

vladossipov avatar Apr 15 '24 15:04 vladossipov

@vladossipov

Unfortunately no. I haven't found a fix so have removed the ranking from the query loop for now.

I wondered if I used WPCode to create a custom shortcode if I could make it work. But I haven't spent the time on this project.

beckej13820 avatar Apr 16 '24 00:04 beckej13820