WP_Widget_Media_Audio::render_media()
Render the media on the frontend.
Method of the class: WP_Widget_Media_Audio{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WP_Widget_Media_Audio = new WP_Widget_Media_Audio(); $WP_Widget_Media_Audio->render_media( $instance );
- $instance(array) (required)
- Widget instance props.
Changelog
Since 4.8.0 | Introduced. |
WP_Widget_Media_Audio::render_media() WP Widget Media Audio::render media code WP 6.7.1
public function render_media( $instance ) { $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' ), $instance ); $attachment = null; if ( $this->is_attachment_with_mime_type( $instance['attachment_id'], $this->widget_options['mime_type'] ) ) { $attachment = get_post( $instance['attachment_id'] ); } if ( $attachment ) { $src = wp_get_attachment_url( $attachment->ID ); } else { $src = $instance['url']; } echo wp_audio_shortcode( array_merge( $instance, compact( 'src' ) ) ); }