• Resolved snomo

    (@snomo)


    Trying to use this plugin to be able to play a sound file unique to each post. I guess there are two ways to do it, one is to get the file from the custom file field, but I don’t think the plugin supports that. The second way is to have a url for each post the shows the sound file location.

    How would I go about populating the URL in the shortcode with a custom field value related to a custom post?

    I’ve tried the following but can’t get it to work…

    <?php $post_meta_value = get_post_meta($post->ID, 'sound_url',TRUE);
    echo do_shortcode('[sc_embed_player fileurl= ".$post_meta_value."]'); ?>

    and neither does this…

    <?php echo do_shortcode('[sc_embed_player fileurl= "'.get_post_meta($post->ID, 'sound_url', true).'"]'); ?>

    thanks!

    http://wordpress.org/extend/plugins/compact-wp-audio-player/

Viewing 1 replies (of 1 total)
  • you should be able to retrieve the URL from a custom field and use it with the plugin.

    Your sample code looks wrong which is most likely why it is not working. Try the following example:

    <?php
    $post_meta_value = get_post_meta($post->ID, 'sound_url',TRUE);
    echo do_shortcode('[sc_embed_player fileurl='.$post_meta_value.']');
    ?>

Viewing 1 replies (of 1 total)

The topic ‘Dynamic URL in Shortcode’ is closed to new replies.