2013-07-28 18:55:10 -04:00
< ? php
/**
2013-10-11 18:02:11 -04:00
* The template to display recent Featured Posts
*
2013-07-28 18:55:10 -04:00
* @ package WordPress
* @ subpackage Twenty_Fourteen
2013-10-11 18:02:11 -04:00
* @ since Twenty Fourteen 1.0
2013-07-28 18:55:10 -04:00
*/
if ( isset ( $GLOBALS [ 'content_width' ] ) )
$GLOBALS [ 'content_width' ] = 306 ;
2013-08-14 23:13:29 -04:00
$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 );
2013-07-28 18:55:10 -04:00
?>
2013-08-14 23:13:29 -04:00
< article id = " post-<?php the_ID(); ?> " < ? php post_class (); ?> >
< div class = " entry-content " >
2013-07-28 18:55:10 -04:00
< ? php
2013-08-14 23:13:29 -04:00
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' );
2013-07-28 18:55:10 -04:00
?>
2013-08-14 23:13:29 -04:00
< 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 () ),
2013-07-28 18:55:10 -04:00
number_format_i18n ( $total_images )
2013-08-14 23:13:29 -04:00
);
?>
</ p >
< ? php
2013-07-28 18:55:10 -04:00
else :
the_excerpt ();
endif ;
else :
the_content ( __ ( 'Continue reading <span class="meta-nav">→</span>' , 'twentyfourteen' ) );
endif ;
?>
</ div ><!-- . entry - content -->
< header class = " entry-header " >
< div class = " entry-meta " >
< ? php
2013-08-14 23:13:29 -04:00
if ( ! has_post_format ( 'link' ) ) :
the_title ( '<h1 class="entry-title"><a href="' . esc_url ( get_permalink () ) . '" rel="bookmark">' , '</a></h1>' );
2013-07-28 18:55:10 -04:00
endif ;
2013-08-14 23:13:29 -04:00
twentyfourteen_posted_on ();
if ( ! post_password_required () && ( comments_open () || get_comments_number () ) ) :
2013-07-28 18:55:10 -04:00
?>
< 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 -->
2013-08-14 23:13:29 -04:00
</ article ><!-- #post-## -->