Twenty Fourteen: cleanup, props iamtakashi. Fixes #25613.

* With the ephemera widget in place, `content-recent-formatted-post.php` is unused, see #25028.
* We're no longe filtering formatted posts from the main query, see #25330.
 * Fix a typo.
Built from https://develop.svn.wordpress.org/trunk@25814


git-svn-id: http://core.svn.wordpress.org/trunk@25726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-10-16 18:29:09 +00:00
parent fafbee59f9
commit 38b333977e
3 changed files with 1 additions and 147 deletions

View File

@ -1,69 +0,0 @@
<?php
/**
* The template to display recent Featured Posts
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
if ( isset( $GLOBALS['content_width'] ) )
$GLOBALS['content_width'] = 306;
$images = get_posts( array(
'post_parent' => 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 );
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php
if ( has_post_format( 'gallery' ) ) :
if ( has_post_thumbnail() ) :
$featured_image = get_the_post_thumbnail( get_the_ID(), 'featured-thumbnail-formatted' );
elseif ( $total_images > 0 ) :
$image = array_shift( $images );
$featured_image = wp_get_attachment_image( $image, 'featured-thumbnail-formatted' );
?>
<a href="<?php the_permalink(); ?>"><?php echo $featured_image; ?></a>
<p class="wp-caption-text">
<?php
printf( _n( 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photo</a>.', 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photos</a>.', $total_images, 'twentyfourteen' ),
esc_url( get_permalink() ),
number_format_i18n( $total_images )
);
?>
</p>
<?php
else :
the_excerpt();
endif;
else :
the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );
endif;
?>
</div><!-- .entry-content -->
<header class="entry-header">
<div class="entry-meta">
<?php
if ( ! has_post_format( 'link' ) ) :
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
endif;
twentyfourteen_posted_on();
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
?>
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
<?php endif; ?>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
</article><!-- #post-## -->

View File

@ -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.
*

View File

@ -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 );
}
/**