<?php
if (strstr($audio, '<iframe')) {
echo $audio;
} else {
echo wp_oembed_get( get_post_meta($post->ID, '_format_audio_embed', true) );
}
?>
Of course, this would require that you get the custom field with the audio embed code or url into $audio 🙂
Edit – try:
<?php
$audio = get_post_meta($post->ID, '_format_audio_embed', true);
if (strstr($audio, '<iframe')) {
echo $audio;
} else {
echo wp_oembed_get( $audio );
}
?>
Related Posts:
- How can I remove the first video from a post and feature it?
- has_post_format() vs. get_post_format()
- WP Oembed not passing through the “autoplay=1” variable
- static variable loop not working in WordPress
- Get first video from the post (both embed and video shortcodes)
- What difference does it make if I enable support for video post format?
- Replace audio/video enclosure with player?
- How do I remove the post format meta box?
- How add class youtube and type/html to oembed code?
- Modify youtube video size on one page and show another size on different page
- Adding post-formats to Twenty Ten child theme
- Is there a real life use case for post formats except for microbloging?
- Renaming post formats after Gutenberg
- Embed .mov file via ‘Add Media’ not working
- Set wmode attribute to transparent for the embed shortcode to make drop-down menu hover over YouTube embed in Internet Explorer
- Detecting Embed URLs Within post_content
- How to add new embed handler not supported by oembed
- What is the recommended behavior for the post formats?
- Manipulating oembed_dataparse stopped working for YouTube embeds
- How to remove the embed_footer?
- wp_embed_register_handler is not working
- Custom Post Formats
- Any way to use a custom Parameter for vimeo embed without using an iframe?
- Removing WordPress Icon from oembed link footer
- Target all posts that are NOT aside or link post formats
- Get all Youtube video’s from posts and embed them on a different page
- Hiding Comments Icon On oembed
- wp_embed_register_handler to embed html files
- Filter the first from Quote Post Format
- Displaying all Video Post Formats to Page
- How to add oEmbed support to my theme?
- Audio Playlists – Multiple file type support?
- Vimeo video embeds doesnt seem to work with ACF [closed]
- Display Post Format as a String
- Can I use wp_oembed_get to detect a valid embeddable link or is there a better way to do so?
- Different markup for each post format
- Embeding YouTube video via a template function throws iframe cross-domain policy error
- Instagram URL is converted into oEmbed
- Video Embed with Captions in Turkish
- How can I force oEmbed to display fixed height & width dimensions?
- Responsive embed for the video shortcode
- How to recognise on which site the content is being rendered?
- post formats – how to get the relevant content part?
- How to register a embed handler as a fallback to a oEmbed handler?
- Post formats for Pages not saving
- oEmbed not working in WordPress
- How to apply an ID to Shortcode Embedded iframe
- Is there any problem if I use get_template_part like this?
- previous_post_link/next_post_link disappear when excluding by post_format
- How to Implement Responsive YouTube Video Framing? [closed]
- Usage of post_formats
- Viddler oEmbed not working with specified width
- Responsive Embeds using default embed shortcode
- How can I replace an oEmbed URL in post with actual embed HTML
- How to embed YouTube videos in posts without adding suggested videos at the end?
- how to get list of post formats supported by theme?
- Formatting Standard Post Format
- If post-format == ‘gallery’ conditional
- WordPress keeps autoplaying my Youtube-Links no matter what I write
- Adding new post format on plugin activation
- Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)
- post formats – where’s the difference: “aside” vs. “status”?
- Div around YouTube video
- How to get the id or url of the image in an image post?
- WordPress get_media_embedded
- How to make enqueue_embed_scripts work with the embed_template filter
- oEmbded with wp_insert_post() [embedly]
- Audio post format with Advanced Custom Fields
- About post format
- Static image for embedded YouTube video instead of blank player?
- Smart post format loop problems
- “post-format” code snippets list [closed]
- Is it possible to embed a wordpress tag page on wordpress?
- Add class and change src type inside wp_oembed_get
- Auto embeds don’t work for attachment descriptions
- Embedding local video in WordPress comments
- wordpress post formats
- Facebook embeds fixing with functions.php
- Embed video from streamtape using direct link
- Security when outputing wp_oembed_get code
- How to disable URL preview in WordPress comments
- How to modify the HTML output of Gutenberg block? (Youtube)
- How to display quote format by preg_match function?
- Remove wordpress embed share icon?
- I would like to have a quote page just to show quotes
- oembed facebook link?
- Insert Link to Audio versus Embed Audio Player
- WordPress Mediaelement – Youtube Videos Embed Options
- How to display list of video post on video section?
- Paste from word not preserving formatting
- Hide download button from audio player
- Adding an official oEmbed provider to WordPress
- How to treat post formats?
- Post formats and template hierarchy
- Change standard post format metabox
- How can I add WordPress Audio Player as featured audio in Audio Blog Posts?
- Next Post Link in format
- Mass post format changer?
- Custom formatting
- Completely disable oEmbed and auto-embed on frontend and post editor?