content-gallery.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Template part for displaying gallery 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() && ! 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. /* translators: %s: Name of current post */
  59. the_content( sprintf(
  60. __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ),
  61. get_the_title()
  62. ) );
  63. wp_link_pages( array(
  64. 'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ),
  65. 'after' => '</div>',
  66. 'link_before' => '<span class="page-number">',
  67. 'link_after' => '</span>',
  68. ) );
  69. };
  70. ?>
  71. </div><!-- .entry-content -->
  72. <?php
  73. if ( is_single() ) {
  74. twentyseventeen_entry_footer();
  75. }
  76. ?>
  77. </article><!-- #post-## -->