content-image.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Template part for displaying image posts
  4. *
  5. * @link https://codex.wordpress.org/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 if ( is_single() || '' === get_the_post_thumbnail() ) {
  49. // Only show content if is a single post, or if there's no featured image.
  50. /* translators: %s: Name of current post */
  51. the_content( sprintf(
  52. __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
  53. get_the_title()
  54. ) );
  55. wp_link_pages( array(
  56. 'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
  57. 'after' => '</div>',
  58. 'link_before' => '<span class="page-number">',
  59. 'link_after' => '</span>',
  60. ) );
  61. };
  62. ?>
  63. </div><!-- .entry-content -->
  64. <?php
  65. if ( is_single() ) {
  66. twentyseventeen_entry_footer();
  67. }
  68. ?>
  69. </article><!-- #post-## -->