I'm trying to output
[embedyt]http://www.youtube.com/embed?layout=gallery&listType=playlist&list=*some-playlist*[/embedyt]
By using a combination of Advanced Custom Fields and a YouTube plugin in Wordpress.
My code is:
<?php
echo do_shortcode('[[embedyt]' . the_field('youtube-playlist') . '[/embedyt]]');
?>
where the [emedyt] tags are from Embed YouTube and the_field('youtube-playlist') is from Advanced Custom Fields.
Unfortunately what gets output is
http://www.youtube.com/embed?layout=gallery&listType=playlist&list=*some-test-playlist*[embedyt][/embedyt]
Where am I going wrong with my PHP? I have different variations, like using variables and different types of concatenating but I am obviously missing something.
You're calling the_field
function which actually prints the value of custom field but you actually need to pass the value to do_shortcode
function instead of displaying it.
You've to use get_field
function instead. Try updating your code to following
<?php echo do_shortcode('[[embedyt]' . get_field('youtube-playlist') . '[/embedyt]]'); ?>