You appear to be a bot. Output may be restricted
Description
Output the HTML for this widget.
Usage
Twenty_Fourteen_Ephemera_Widget::widget( $args, $instance );
Parameters
- $args
- ( array ) required – An array of standard parameters for widgets in this theme.
- $instance
- ( array ) required – An array of settings for this widget instance.
Returns
void
Source
File name: twentyfourteen/inc/widgets.php
Lines:
1 to 100 of 185
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' ); $format_string_more = __( 'More audio', 'twentyfourteen' ); break; case 'quote': $format_string = __( 'Quotes', 'twentyfourteen' ); $format_string_more = __( 'More quotes', 'twentyfourteen' ); break; case 'link': $format_string = __( 'Links', 'twentyfourteen' ); $format_string_more = __( 'More links', 'twentyfourteen' ); break; case 'gallery': $format_string = __( 'Galleries', 'twentyfourteen' ); $format_string_more = __( 'More galleries', 'twentyfourteen' ); break; case 'aside': default: $format_string = __( 'Asides', 'twentyfourteen' ); $format_string_more = __( 'More asides', 'twentyfourteen' ); break; } $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : 2; $title = ! empty( $instance['title'] ) ? $instance['title'] : $format_string; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $ephemera = new WP_Query( array( 'order' => 'DESC', 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'post__not_in' => get_option( 'sticky_posts' ), 'tax_query' => array( array( 'taxonomy' => 'post_format', 'terms' => array( "post-format-$format" ), 'field' => 'slug', 'operator' => 'IN', ), ), ) ); if ( $ephemera->have_posts() ) : $tmp_content_width = $GLOBALS['content_width']; $GLOBALS['content_width'] = 306; echo $args['before_widget']; ?> <h1 class="widget-title <?php echo esc_attr( $format ); ?>"> <a class="entry-format" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php echo esc_html( $title ); ?></a> </h1> <ol> <?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); $tmp_more = $GLOBALS['more']; $GLOBALS['more'] = 0; ?> <li> <article <?php post_class(); ?>> <div class="entry-content"> <?php if ( has_post_format( 'gallery' ) ) : if ( post_password_required() ) : the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) ); else : $images = array(); $galleries = get_post_galleries( get_the_ID(), false ); if ( isset( $galleries[0]['ids'] ) ) { $images = explode( ',', $galleries[0]['ids'] ); } if ( ! $images ) : $images = get_posts( array( 'fields' => 'ids', 'numberposts' => -1, 'order' => 'ASC',