wppaste
WordPress

Twenty_Fourteen_Ephemera_Widget

Since
Twenty Fourteen 1.0
Source
wp-content/themes/twentyfourteen/inc/widgets.php:13
Custom Widget for displaying specific post formats

Description

Displays posts from Aside, Quote, Video, Audio, Image, Gallery, and Link formats.

Compatibility

WordPress
since Twenty Fourteen 1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 3

Every hook that fires from inside Twenty_Fourteen_Ephemera_Widget, in the order it appears in the class, grouped by the method that fires it.

Properties · 1

$formatsarrayprivate
The supported post formats.

Methods · 5

Source code

class Twenty_Fourteen_Ephemera_Widget extends WP_Widget { 	/**	 * The supported post formats.	 *	 * @since Twenty Fourteen 1.0	 *	 * @var array	 */	private $formats = array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery' ); 	/**	 * Constructor.	 *	 * @since Twenty Fourteen 1.0	 *	 * @return Twenty_Fourteen_Ephemera_Widget Widget instance.	 */	public function __construct() {		parent::__construct(			'widget_twentyfourteen_ephemera',			__( 'Twenty Fourteen Ephemera', 'twentyfourteen' ),			array(				'classname'                   => 'widget_twentyfourteen_ephemera',				'description'                 => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts.', 'twentyfourteen' ),				'customize_selective_refresh' => true,			)		); 		if ( is_active_widget( false, false, $this->id_base ) || is_customize_preview() ) {			add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );		}	} 	/**	 * Enqueues scripts.	 *	 * @since Twenty Fourteen 1.7	 */	public function enqueue_scripts() {		/** This filter is documented in wp-includes/media.php */		$audio_library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );		/** This filter is documented in wp-includes/media.php */		$video_library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );		if ( in_array( 'mediaelement', array( $video_library, $audio_library ), true ) ) {			wp_enqueue_style( 'wp-mediaelement' );			wp_enqueue_script( 'mediaelement-vimeo' );			wp_enqueue_script( 'wp-mediaelement' );		}	} 	/**	 * Outputs the HTML for this widget.	 *	 * @since Twenty Fourteen 1.0	 *	 * @global int $content_width Content width.	 * @global int $more	 *	 * @param array $args     An array of standard parameters for widgets in this theme.	 * @param array $instance An array of settings for this widget instance.	 */	public function widget( $args, $instance ) {		$format = isset( $instance['format'] ) ? $instance['format'] : ''; 		if ( ! $format || ! in_array( $format, $this->formats, true ) ) {			$format = 'aside';		} 		switch ( $format ) {			case 'image':				$format_string      = __( 'Images', 'twentyfourteen' );				$format_string_more = __( 'More images', 'twentyfourteen' );				break;			case 'video':				$format_string      = __( 'Videos', 'twentyfourteen' );				$format_string_more = __( 'More videos', 'twentyfourteen' );				break;			case 'audio':				$format_string      = __( 'Audio', 'twentyfourteen' );

Changelog

Introduced in Twenty Fourteen 1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-content/themes/twentyfourteen/inc/widgets.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.