X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/256a3b381f63716209b3527d0a14442ae570c283..16e7b37c7914d753890c1a05a9335f3b43751eb8:/wp-content/themes/twentyfourteen/inc/widgets.php?ds=sidebyside diff --git a/wp-content/themes/twentyfourteen/inc/widgets.php b/wp-content/themes/twentyfourteen/inc/widgets.php deleted file mode 100644 index f78effed..00000000 --- a/wp-content/themes/twentyfourteen/inc/widgets.php +++ /dev/null @@ -1,250 +0,0 @@ - 'widget_twentyfourteen_ephemera', - 'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts', 'twentyfourteen' ), - ) ); - - /* - * @todo http://core.trac.wordpress.org/ticket/23257: Add plural versions of Post Format strings - */ - $this->format_strings = array( - 'aside' => __( 'Asides', 'twentyfourteen' ), - 'image' => __( 'Images', 'twentyfourteen' ), - 'video' => __( 'Videos', 'twentyfourteen' ), - 'audio' => __( 'Audio', 'twentyfourteen' ), - 'quote' => __( 'Quotes', 'twentyfourteen' ), - 'link' => __( 'Links', 'twentyfourteen' ), - 'gallery' => __( 'Galleries', 'twentyfourteen' ), - ); - } - - /** - * Output the HTML for this widget. - * - * @access public - * @since Twenty Fourteen 1.0 - * - * @param array $args An array of standard parameters for widgets in this theme. - * @param array $instance An array of settings for this widget instance. - * @return void Echoes its output. - */ - public function widget( $args, $instance ) { - $format = $instance['format']; - $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] ); - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? $this->format_strings[ $format ] : $instance['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']; - ?> -

- -

-
    - - have_posts() ) : $ephemera->the_post(); ?> -
  1. -
    > -
    - →', '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', - 'orderby' => 'menu_order', - 'post_mime_type' => 'image', - 'post_parent' => get_the_ID(), - 'post_type' => 'attachment', - ) ); - endif; - - $total_images = count( $images ); - - if ( has_post_thumbnail() ) : - $post_thumbnail = get_the_post_thumbnail(); - elseif ( $total_images > 0 ) : - $image = array_shift( $images ); - $post_thumbnail = wp_get_attachment_image( $image, 'post-thumbnail' ); - endif; - - if ( ! empty ( $post_thumbnail ) ) : - ?> - - -

    - %2$s photo.', 'This gallery contains %2$s photos.', $total_images, 'twentyfourteen' ), - esc_url( get_permalink() ), - number_format_i18n( $total_images ) - ); - ?> -

    - →', 'twentyfourteen' ) ); - endif; - ?> -
    - -
    - -
    -
    -
  2. - - -
- →', 'twentyfourteen' ), $this->format_strings[ $format ] ); ?> - formats ) ) { - $instance['format'] = $new_instance['format']; - } - - return $instance; - } - - /** - * Display the form for this widget on the Widgets page of the Admin area. - * - * @since Twenty Fourteen 1.0 - * - * @param array $instance - * @return void - */ - function form( $instance ) { - $title = empty( $instance['title'] ) ? '' : esc_attr( $instance['title'] ); - $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] ); - $format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside'; - ?> -

-

- -

-

- -

- -