content-front-page.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. <article id="post-<?php the_ID(); ?>" <?php post_class( 'twentyseventeen-panel ' ); ?> >
  12. <?php if ( has_post_thumbnail() ) :
  13. $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' );
  14. // Calculate aspect ratio: h / w * 100%.
  15. $ratio = $thumbnail[2] / $thumbnail[1] * 100;
  16. ?>
  17. <div class="panel-image" style="background-image: url(<?php echo esc_url( $thumbnail[0] ); ?>);">
  18. <div class="panel-image-prop" style="padding-top: <?php echo esc_attr( $ratio ); ?>%"></div>
  19. </div><!-- .panel-image -->
  20. <?php endif; ?>
  21. <div class="panel-content">
  22. <div class="wrap">
  23. <header class="entry-header">
  24. <?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>
  25. <?php twentyseventeen_edit_link( get_the_ID() ); ?>
  26. </header><!-- .entry-header -->
  27. <div class="entry-content">
  28. <?php
  29. /* translators: %s: Name of current post */
  30. the_content( sprintf(
  31. __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
  32. get_the_title()
  33. ) );
  34. ?>
  35. </div><!-- .entry-content -->
  36. </div><!-- .wrap -->
  37. </div><!-- .panel-content -->
  38. </article><!-- #post-## -->