→', '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 = reset( $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;
?>