WordPress 4.7
[autoinstalls/wordpress.git] / wp-content / themes / twentyseventeen / template-parts / page / content-front-page.php
1 <?php
2 /**
3  * Displays content for front page
4  *
5  * @package WordPress
6  * @subpackage Twenty_Seventeen
7  * @since 1.0
8  * @version 1.0
9  */
10
11 ?>
12 <article id="post-<?php the_ID(); ?>" <?php post_class( 'twentyseventeen-panel ' ); ?> >
13
14         <?php if ( has_post_thumbnail() ) :
15                 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' );
16
17                 $post_thumbnail_id = get_post_thumbnail_id( $post->ID );
18
19                 $thumbnail_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' );
20
21                 // Calculate aspect ratio: h / w * 100%.
22                 $ratio = $thumbnail_attributes[2] / $thumbnail_attributes[1] * 100;
23                 ?>
24
25                 <div class="panel-image" style="background-image: url(<?php echo esc_url( $thumbnail[0] ); ?>);">
26                         <div class="panel-image-prop" style="padding-top: <?php echo esc_attr( $ratio ); ?>%"></div>
27                 </div><!-- .panel-image -->
28
29         <?php endif; ?>
30
31         <div class="panel-content">
32                 <div class="wrap">
33                         <header class="entry-header">
34                                 <?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
35
36                                 <?php twentyseventeen_edit_link( get_the_ID() ); ?>
37
38                         </header><!-- .entry-header -->
39
40                         <div class="entry-content">
41                                 <?php
42                                         /* translators: %s: Name of current post */
43                                         the_content( sprintf(
44                                                 __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
45                                                 get_the_title()
46                                         ) );
47                                 ?>
48                         </div><!-- .entry-content -->
49
50                 </div><!-- .wrap -->
51         </div><!-- .panel-content -->
52
53 </article><!-- #post-## -->