do_shortcode inside loop doesn’t pull correct post data
-
I have a custom field (using Meta Boxes) to add MP3 files to a custom post type. When I use the default [audio] embed, everything works as expected. I installed this plugin and am using do_shortcode like so…
echo do_shortcode(‘[crazyplayer_narrow title=”‘.get_the_title().'” artist=”…
The shortcode is getting the data from the first/oldest post including the title as you see from my snippet and also the mp3 file when I inject that.
I can echo the current/correct page information – including the mp3 url – before and after the shortcode so I know the loop is fine. The rest of the loop output is good – it’s only the audio player that displaying the wrong info.
Also, only the top/newest post on the page displays the audio player. Each subsequent post on the (customer archive) page doesn’t include a player.
As I’m writing this out, it seems the issue may be simply that this plugin doesn’t allow for multiple players on the same page. Which is very unfortunate.
If you’re able to comment, I would still love to hear you thoughts.
The topic ‘do_shortcode inside loop doesn’t pull correct post data’ is closed to new replies.