content-image.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Template part for displaying image posts
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  6. *
  7. * @package WordPress
  8. * @subpackage Twenty_Seventeen
  9. * @since 1.0
  10. * @version 1.2
  11. */
  12. ?>
  13. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  14. <?php
  15. if ( is_sticky() && is_home() ) {
  16. echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
  17. }
  18. ?>
  19. <header class="entry-header">
  20. <?php
  21. if ( 'post' === get_post_type() ) {
  22. echo '<div class="entry-meta">';
  23. if ( is_single() ) {
  24. twentyseventeen_posted_on();
  25. } else {
  26. echo twentyseventeen_time_link();
  27. twentyseventeen_edit_link();
  28. };
  29. echo '</div><!-- .entry-meta -->';
  30. };
  31. if ( is_single() ) {
  32. the_title( '<h1 class="entry-title">', '</h1>' );
  33. } elseif ( is_front_page() && is_home() ) {
  34. the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
  35. } else {
  36. the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
  37. }
  38. ?>
  39. </header><!-- .entry-header -->
  40. <?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?>
  41. <div class="post-thumbnail">
  42. <a href="<?php the_permalink(); ?>">
  43. <?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?>
  44. </a>
  45. </div><!-- .post-thumbnail -->
  46. <?php endif; ?>
  47. <div class="entry-content">
  48. <?php
  49. if ( is_single() || '' === get_the_post_thumbnail() ) {
  50. // Only show content if is a single post, or if there's no featured image.
  51. the_content(
  52. sprintf(
  53. /* translators: %s: Post title. */
  54. __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
  55. get_the_title()
  56. )
  57. );
  58. wp_link_pages(
  59. array(
  60. 'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
  61. 'after' => '</div>',
  62. 'link_before' => '<span class="page-number">',
  63. 'link_after' => '</span>',
  64. )
  65. );
  66. };
  67. ?>
  68. </div><!-- .entry-content -->
  69. <?php
  70. if ( is_single() ) {
  71. twentyseventeen_entry_footer();
  72. }
  73. ?>
  74. </article><!-- #post-<?php the_ID(); ?> -->