3 * Template part for displaying pages on front page
6 * @subpackage Twenty_Seventeen
11 global $twentyseventeencounter;
15 <article id="panel<?php echo $twentyseventeencounter; ?>" <?php post_class( 'twentyseventeen-panel ' ); ?> >
17 <?php if ( has_post_thumbnail() ) :
18 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' );
20 // Calculate aspect ratio: h / w * 100%.
21 $ratio = $thumbnail[2] / $thumbnail[1] * 100;
24 <div class="panel-image" style="background-image: url(<?php echo esc_url( $thumbnail[0] ); ?>);">
25 <div class="panel-image-prop" style="padding-top: <?php echo esc_attr( $ratio ); ?>%"></div>
26 </div><!-- .panel-image -->
30 <div class="panel-content">
32 <header class="entry-header">
33 <?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
35 <?php twentyseventeen_edit_link( get_the_ID() ); ?>
37 </header><!-- .entry-header -->
39 <div class="entry-content">
41 /* translators: %s: Name of current post */
43 __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
47 </div><!-- .entry-content -->
50 // Show recent blog posts if is blog posts page (Note that get_option returns a string, so we're casting the result as an int).
51 if ( get_the_ID() === (int) get_option( 'page_for_posts' ) ) : ?>
53 <?php // Show four most recent posts.
54 $recent_posts = new WP_Query( array(
55 'posts_per_page' => 3,
56 'post_status' => 'publish',
57 'ignore_sticky_posts' => true,
58 'no_found_rows' => true,
62 <?php if ( $recent_posts->have_posts() ) : ?>
64 <div class="recent-posts">
67 while ( $recent_posts->have_posts() ) : $recent_posts->the_post();
68 get_template_part( 'template-parts/post/content', 'excerpt' );
72 </div><!-- .recent-posts -->
77 </div><!-- .panel-content -->
79 </article><!-- #post-## -->