Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created custom field and placed this inside the loop:

<?php echo get_post_meta($post->ID, 'ses', true); ?>

But now the link is all text. I would like it to be like my theme does when I use this shortcode:

[media url="http://www.example.com/songname.mp3"] 
share|improve this question

1 Answer 1

You have to echo the full Audio Tag and insert the custom field MP3 address in it.

<?php 
    if ( get_post_meta($post->ID, 'ses', true) ) {
        echo '<audio controls="controls">
                <source src="' . get_post_meta($post->ID, 'ses', true) . '" />
                </audio>'; 
    }
?>
share|improve this answer
    
perfect. thank you –  1907 Jun 13 '12 at 18:51
    
one little problem. now the player is in every post. –  1907 Jun 13 '12 at 19:13
    
The Codex is your friend, read the Codex. Answer updated :) –  brasofilo Jun 13 '12 at 19:19
    
brasofilo, could you help me out with one last thing, now i tried to post youtube video. how can i make it visible in my site? i found youtube id code. but i want to make it with full yotube video url. thank you... –  1907 Jun 13 '12 at 23:06
    
1907, WordPress has a feature called oEmbed that can help you with that, search for it here or at WordPress Forums. Hopefully, you'll be around enough time to find that this site is a great learning resource. For a better experience I suggest you read the full FAQ (you'll even earn an extra badge for that :). –  brasofilo Jun 13 '12 at 23:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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