Variables in shortcodes
i have a noob question. im using Advanced custom fields and custom post types as well as custom template types. However im stuck where i need to echo an advanced custom field in the shortcode of mycred. example:
<?php $variable = the_field(‘youtube_video_id’);
echo do_shortcode(‘[mycred_video id=”‘.$variable.'” width=”800″ height=”” amount=”5″ logic=”interval” interval=”15″]’); ?>
say in the above im using the youtube video mycred shortcode. to show the view i want to echo an advanced custom field for the video id, this was i can have users make posts using their videos custom id without them having to learn mycred shortcodes, they simply add just the video id which i can echo in your shortcode.
Is there anyway i can use mycred with php and not have to use the echo do_shortcode method?
Any assistance will be greatly appreciated
- The topic ‘Variables in shortcodes’ is closed to new replies.