$images_ids[] = $img['ID']; } $media_html = '
' . do_shortcode( '[gallery ids="' . join( ',', $images_ids ) . '"]' ) . '
'; } } else if ( $post_format == 'video' ) { $media_html = '
'; if ( strpos( $video, 'vimeo.com/' ) > 0 ) { $video_id = substr( $video, strpos( $video, 'vimeo.com/' ) + 10 ); $media_html .= ''; } else { $yt_id_pattern = '~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*~i'; $youtube_id = ( preg_replace( $yt_id_pattern, '$1', $video ) ); if ( strlen( $youtube_id ) == 11 ) { $media_html .= ''; } else { $media_html = '
'; $media_html .= do_shortcode( $video ); } } $media_html .= '
'; if ( $video == '' ) { $media_html = ''; } } else if ( $post_format == 'audio' ) { if ( strpos( $audio, '' ) > 0 ) { $media_html = '
' . $audio . '
'; } else { $media_html = '
' . do_shortcode( $audio ) . '
'; } if ( $audio == '' ) { $media_html = ''; } } else if ( $post_format == 'link' ) { $media_html = '
'; if ( esc_html( $link_title ) == '' || esc_url( $link_url ) == '' ) { $media_html = ''; } } else if ( $post_format == 'quote' ) { $media_html = '

' . esc_html( $quote ) . '

' . esc_html( $quote_author ) . '
';