content-gallery.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * Template part for displaying gallery 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() && ! get_post_gallery() ) : ?>
  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() ) {
  50. // If not a single post, highlight the gallery.
  51. if ( get_post_gallery() ) {
  52. echo '<div class="entry-gallery">';
  53. echo get_post_gallery();
  54. echo '</div>';
  55. };
  56. };
  57. if ( is_single() || ! get_post_gallery() ) {
  58. the_content(
  59. sprintf(
  60. /* translators: %s: Post title. */
  61. __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
  62. get_the_title()
  63. )
  64. );
  65. wp_link_pages(
  66. array(
  67. 'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
  68. 'after' => '</div>',
  69. 'link_before' => '<span class="page-number">',
  70. 'link_after' => '</span>',
  71. )
  72. );
  73. };
  74. ?>
  75. </div><!-- .entry-content -->
  76. <?php
  77. if ( is_single() ) {
  78. twentyseventeen_entry_footer();
  79. }
  80. ?>
  81. </article><!-- #post-<?php the_ID(); ?> -->