I'm trying to create a custom shortcode that uses another shortcode for a couple audio players on a Grid displaying a custom post type using Visual Composer.
The audio player that I would like to use is the Compact Audio Player plugin which uses a shortcode of [sc_embed_player fileurl="URL OF THE MP3 FILE"]
.
What I want to do is create 2 custom shortcodes that inject the correct mp3 url into the fileurl=" "
path when the grid loads. I'm using advanced custom fields and the code that I am using for one shortcode in my functions.php
now is (I plan on duplicating when I can get this one to work for the other shortcode):
function get_generic_demo() {
$demo = get_field( 'generic_demo');
echo do_shortcode('[sc_embed_player fileurl="'.$demo['url'].'"]');
}
add_shortcode( 'generic_demo', 'get_generic_demo');
However, it gives me an error saying I didn't input a valid url when the grid displays when my custom shortcode is entered.
I've tried both setting the return from ACF to file url and the array (as used above).
I've also tried:
$demo = get_field( 'generic_demo', $post->ID);
Any help would be much appreciated