content-image.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Template part for displaying posts with the image format.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package Scratchpad
  8. */
  9. /* translators: %s: Name of current post */
  10. $content_text = sprintf(
  11. wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'scratchpad' ), array( 'span' => array( 'class' => array() ) ) ),
  12. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  13. );
  14. $content = apply_filters( 'the_content', get_the_content( $content_text ) );
  15. $image = get_media_embedded_in_content( $content, array( 'image' ) );
  16. ?>
  17. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  18. <?php scratchpad_sticky(); ?>
  19. <?php if ( has_post_thumbnail() && ! post_password_required() ) { ?>
  20. <div class="featured-image">
  21. <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'scratchpad-featured' ); ?></a>
  22. <div class="photo-corners">
  23. <?php
  24. get_template_part( 'images/inline', 'photo-corners.svg' );
  25. get_template_part( 'images/inline', 'photo-corners.svg' );
  26. get_template_part( 'images/inline', 'photo-corners.svg' );
  27. get_template_part( 'images/inline', 'photo-corners.svg' );
  28. ?>
  29. </div><!-- .photo-corners -->
  30. </div><!-- .featured-image -->
  31. <?php } else if ( ! empty( $image ) && ! post_password_required() ) { ?>
  32. <div class="featured-image">
  33. <a href="<?php the_permalink(); ?>"><?php echo $image[0]; ?></a>
  34. <div class="photo-corners">
  35. <?php
  36. get_template_part( 'images/inline', 'photo-corners.svg' );
  37. get_template_part( 'images/inline', 'photo-corners.svg' );
  38. get_template_part( 'images/inline', 'photo-corners.svg' );
  39. get_template_part( 'images/inline', 'photo-corners.svg' );
  40. ?>
  41. </div><!-- .photo-corners -->
  42. </div><!-- .featured-image -->
  43. <?php } ?>
  44. <header class="entry-header">
  45. <?php
  46. the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
  47. ?>
  48. <div class="entry-meta">
  49. <?php scratchpad_post_format(); ?>
  50. <?php scratchpad_posted_on(); ?>
  51. <?php
  52. edit_post_link(
  53. sprintf(
  54. /* translators: %s: Name of current post */
  55. esc_html__( 'Edit %s', 'scratchpad' ),
  56. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  57. ),
  58. '<span class="edit-link"><span class="sep">&bull;</span>',
  59. '</span>'
  60. );
  61. ?>
  62. </div><!-- .entry-meta -->
  63. </header><!-- .entry-header -->
  64. <?php if ( post_password_required() ) {
  65. the_content();
  66. } ?>
  67. </article><!-- #post-## -->