0

I want to put some audio files in a html table using wordpress default [audio] shortcode and using ACF to take the url of song.
because of using two nested shortcode does not renderrd in wordpress, I have done this using a costume shortcode and a function as it is asked in another question here:
ACF for audio url in wordpress audio shortcode
and now this is my code:

add_shortcode('audio_nested',custume_url_callback);
function custume_url_callback ($atts = ''){
    $value = shortcode_atts( array(
        'my_feild' => '',
    ), $atts );
    $urlmusic = get_field($value['my_feild']);
        echo do_shortcode("[audio src='$urlmusic']");
}


now when I use it in the post contebnts it is OK, but when I use my shortcode in a table, the player does not appear in the table and goes on the top of post contents.
but if I use the default [audio src="XXX.mp3"] in the table it works good and will be placed right in the table cell.
I have tested the tablepress plugin and other plugins for table and also I have wrote a simple html table but no change in result. here you can see a screenshot of the problem:
https://pasteboard.co/HO9A2lw.png

0

After spending some days and testing lots of solutions, at last I have solved the problem using wordpress audio php function directly in code instead of using [audio] shortcode and do_shortcode() function.
here you can find more detail and how to use it:
https://codex.wordpress.org/Function_Reference/wp_audio_shortcode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.