diff --git a/wp-content/themes/twentyfourteen/content-recent-formatted-post.php b/wp-content/themes/twentyfourteen/content-recent-formatted-post.php deleted file mode 100644 index 9a998a526a..0000000000 --- a/wp-content/themes/twentyfourteen/content-recent-formatted-post.php +++ /dev/null @@ -1,69 +0,0 @@ - get_post()->post_parent, - 'fields' => 'ids', - 'numberposts' => -1, - 'post_status' => 'inherit', - 'post_type' => 'attachment', - 'post_mime_type' => 'image', - 'order' => 'ASC', - 'orderby' => 'menu_order ID' -) ); -$total_images = count( $images ); -?> - -
> -
- 0 ) : - $image = array_shift( $images ); - $featured_image = wp_get_attachment_image( $image, 'featured-thumbnail-formatted' ); - ?> - -

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

- →', 'twentyfourteen' ) ); - endif; - ?> -
- -
- -
-
diff --git a/wp-content/themes/twentyfourteen/functions.php b/wp-content/themes/twentyfourteen/functions.php index b35c3c6723..941a7e9604 100644 --- a/wp-content/themes/twentyfourteen/functions.php +++ b/wp-content/themes/twentyfourteen/functions.php @@ -356,83 +356,6 @@ function twentyfourteen_list_authors() { } endif; -/** - * Get recent formatted posts that are not featured in Featured Content area. - * - * @since Twenty Fourteen 1.0 - * - * @return object WP_Query - */ -function twentyfourteen_get_recent( $post_format ) { - $args = array( - 'order' => 'DESC', - 'ignore_sticky_posts' => 1, - 'posts_per_page' => 2, - 'tax_query' => array( - array( - 'taxonomy' => 'post_format', - 'terms' => array( $post_format ), - 'field' => 'slug', - 'operator' => 'IN', - ), - ), - 'no_found_rows' => true, - ); - - $featured_posts = twentyfourteen_get_featured_posts(); - - if ( is_array( $featured_posts ) && ! empty( $featured_posts ) ) - $args['post__not_in'] = wp_list_pluck( $featured_posts, 'ID' ); - - return new WP_Query( $args ); -} - -/** - * Filter the home page posts, and remove formatted posts visible in the sidebar from it - * - * @since Twenty Fourteen 1.0 - * - * @return void - */ -function twentyfourteen_pre_get_posts( $query ) { - // Bail if not home, not a query, not main query. - if ( ! $query->is_main_query() || is_admin() ) - return; - - // Only on the home page - if ( $query->is_home() ) { - $exclude_ids = array(); - - $videos = twentyfourteen_get_recent( 'post-format-video' ); - $images = twentyfourteen_get_recent( 'post-format-image' ); - $galleries = twentyfourteen_get_recent( 'post-format-gallery' ); - $asides = twentyfourteen_get_recent( 'post-format-aside' ); - $links = twentyfourteen_get_recent( 'post-format-link' ); - $quotes = twentyfourteen_get_recent( 'post-format-quote' ); - - foreach ( $videos->posts as $post ) - $exclude_ids[] = $post->ID; - - foreach ( $images->posts as $post ) - $exclude_ids[] = $post->ID; - - foreach ( $galleries->posts as $post ) - $exclude_ids[] = $post->ID; - - foreach ( $asides->posts as $post ) - $exclude_ids[] = $post->ID; - - foreach ( $links->posts as $post ) - $exclude_ids[] = $post->ID; - - foreach ( $quotes->posts as $post ) - $exclude_ids[] = $post->ID; - - $query->set( 'post__not_in', $exclude_ids ); - } -} -add_action( 'pre_get_posts', 'twentyfourteen_pre_get_posts' ); - /** * Extend the default WordPress body classes. * diff --git a/wp-content/themes/twentyfourteen/inc/featured-content.php b/wp-content/themes/twentyfourteen/inc/featured-content.php index bde9625b20..705458a3cc 100644 --- a/wp-content/themes/twentyfourteen/inc/featured-content.php +++ b/wp-content/themes/twentyfourteen/inc/featured-content.php @@ -30,7 +30,7 @@ class Featured_Content { * All custom functionality will be hooked into the "init" action. */ public static function setup() { - add_action( 'init', array( __CLASS____, 'init' ), 30 ); + add_action( 'init', array( __CLASS__, 'init' ), 30 ); } /**