WordPress.org

Ready to get started?Download WordPress

Forums

PB oEmbed HTML5 Audio - with Cache Support
[resolved] Function for theme programming? (4 posts)

  1. mwarner1
    Member
    Posted 1 year ago #

    Great plugin. It looks like the only way to embed an audio player is via a post or page. Is there support for a function I could use in my theme files to embed the player? I'd like to be able to pull a URL to an mp3 file out of a custom field and enter that as an argument to a function. Thanks!

    http://wordpress.org/extend/plugins/pb-oembed-html5-audio-with-cache-support/

  2. PascalBajorat
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    yes that's no problem, here is my example code:

    <?php
    // http://codex.wordpress.org/Function_Reference/get_post_meta
    $custom_field_mp3 = get_post_meta(get_the_ID(), 'mp3', true);
    
    if( !empty( $custom_field_mp3 ) ):
    
    // http://codex.wordpress.org/Function_Reference/do_shortcode
    echo do_shortcode('[audio mp3="'.$custom_field_mp3.'"]');
    
    endif;
    ?>

    Please note: There is a new and important update out now v.2.2!

    If you like the Plugin please rate it ;)

  3. mwarner1
    Member
    Posted 1 year ago #

    Awesome. Thank you.

  4. thob
    Member
    Posted 1 year ago #

    sorry wrong place

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.