astra_get_audios_from_post( number $post_id )
Get audio files from post content
Description
Parameters
- $post_id
-
(number) (Required) Post id.
Return
(mixed) Iframe.
Source
File: inc/blog/blog.php
function astra_get_audios_from_post( $post_id ) {
// for audio post type - grab.
$post = get_post( $post_id );
$content = do_shortcode( apply_filters( 'the_content', $post->post_content ) );
$embeds = apply_filters( 'astra_get_post_audio', get_media_embedded_in_content( $content ) );
if ( empty( $embeds ) ) {
return '';
}
// check what is the first embed containg video tag, youtube or vimeo.
foreach ( $embeds as $embed ) {
if ( strpos( $embed, 'audio' ) ) {
return '<span class="ast-post-audio-wrapper">' . $embed . '</span>';
}
}
}
Expand full source code Collapse full source code View on Trac