$callback ) {
if ( is_array( $callback ) && 'entry-thumbnail' === $callback[2] ) {
unset( $callbacks[ $key ] );
break;
}
}
}
if ( in_array( $format, [ 'audio', 'video' ], true ) ) {
array_push( $callbacks, [ [ $this, 'media_markup' ], $format, true ] );
}
return $callbacks;
}
/**
* Display HTML markup for the found media in current post.
*
* @since 1.0.1
*
* @param arrray $callbacks Array of callback functions (may be with args).
* @return string
*/
public function entry_featured_media( $callbacks ) {
$format = get_post_format();
if ( in_array( $format, [ 'audio', 'video', 'gallery' ], true ) ) {
// Add 'media_markup()' to array of callbacks with its args.
array_push( $callbacks, [ [ $this, 'media_markup' ], $format, false ] );
}
return $callbacks;
}
/**
* Display HTML markup for the found media in current Display post.
*
* @since 1.0.1
*
* @param arrray $callbacks Array of callback functions (may be with args).
* @return string
*/
public function dp_featured_media( $callbacks ) {
$format = get_post_format();
if ( in_array( $format, [ 'audio', 'video', 'gallery' ], true ) ) {
// Add 'media_markup()' to array of callbacks with its args.
array_push( $callbacks, [ [ $this, 'media_markup' ], $format, true, false ] );
}
return $callbacks;
}
/**
* Get the HTML markup for the found media in current post.
*
* @since 1.0.1
*
* @param string $media_type audio | video | gallery.
* @param bool $split_media Whether to split the media from the post content.
* @param bool $is_main_query Whether the post is from main query.
* @return void
*/
public function media_markup( $media_type, $split_media, $is_main_query = true ) {
$media_obj = new Media_Grabber( $media_type, $split_media, $is_main_query );
$media_arr = $media_obj->get_media();
$media = $media_arr[0];
if ( ! $media ) {
return;
}
if ( $is_main_query && is_single() ) {
printf( '