content.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Template part for displaying posts.
  4. *
  5. * @link https://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package AltoFocus
  8. */
  9. ?>
  10. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  11. <?php if ( altofocus_has_post_thumbnail() ) : ?>
  12. <figure class="post-thumbnail">
  13. <a href="<?php the_permalink(); ?>">
  14. <?php the_post_thumbnail( 'altofocus-thumb-image' ); ?>
  15. </a>
  16. </figure>
  17. <?php endif; ?>
  18. <header class="entry-header">
  19. <a href="<?php echo esc_url( get_permalink() ) ?>" class="entry-header-wrap" rel="bookmark">
  20. <?php the_title( '<span class="entry-title">', '</span>' ); ?>
  21. <?php
  22. $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
  23. if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
  24. $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
  25. }
  26. $time_string = sprintf( $time_string,
  27. esc_attr( get_the_date( 'c' ) ),
  28. esc_html( get_the_date() ),
  29. esc_attr( get_the_modified_date( 'c' ) ),
  30. esc_html( get_the_modified_date() )
  31. );
  32. echo '<span class="posted-on">' . $time_string . '</span>'; // WPCS: XSS OK.
  33. ?>
  34. </a>
  35. <?php
  36. edit_post_link(
  37. sprintf(
  38. /* translators: %s: Name of current post */
  39. esc_html__( 'Edit %s', 'altofocus' ),
  40. the_title( '<span class="screen-reader-text">"', '"</span>', false )
  41. ),
  42. '<span class="edit-link">',
  43. '</span>'
  44. );
  45. ?>
  46. </header>
  47. </article>