entry-header.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Displays the post header
  4. *
  5. * @package WordPress
  6. * @subpackage Twenty_Twenty
  7. * @since Twenty Twenty 1.0
  8. */
  9. $entry_header_classes = '';
  10. if ( is_singular() ) {
  11. $entry_header_classes .= ' header-footer-group';
  12. }
  13. ?>
  14. <header class="entry-header has-text-align-center<?php echo esc_attr( $entry_header_classes ); ?>">
  15. <div class="entry-header-inner section-inner medium">
  16. <?php
  17. /**
  18. * Allow child themes and plugins to filter the display of the categories in the entry header.
  19. *
  20. * @since Twenty Twenty 1.0
  21. *
  22. * @param bool Whether to show the categories in header, Default true.
  23. */
  24. $show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true );
  25. if ( true === $show_categories && has_category() ) {
  26. ?>
  27. <div class="entry-categories">
  28. <span class="screen-reader-text"><?php _e( 'Categories', 'twentytwenty' ); ?></span>
  29. <div class="entry-categories-inner">
  30. <?php the_category( ' ' ); ?>
  31. </div><!-- .entry-categories-inner -->
  32. </div><!-- .entry-categories -->
  33. <?php
  34. }
  35. if ( is_singular() ) {
  36. the_title( '<h1 class="entry-title">', '</h1>' );
  37. } else {
  38. the_title( '<h2 class="entry-title heading-size-1"><a href="' . esc_url( get_permalink() ) . '">', '</a></h2>' );
  39. }
  40. $intro_text_width = '';
  41. if ( is_singular() ) {
  42. $intro_text_width = ' small';
  43. } else {
  44. $intro_text_width = ' thin';
  45. }
  46. if ( has_excerpt() && is_singular() ) {
  47. ?>
  48. <div class="intro-text section-inner max-percentage<?php echo $intro_text_width; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>">
  49. <?php the_excerpt(); ?>
  50. </div>
  51. <?php
  52. }
  53. // Default to displaying the post meta.
  54. twentytwenty_the_post_meta( get_the_ID(), 'single-top' );
  55. ?>
  56. </div><!-- .entry-header-inner -->
  57. </header><!-- .entry-header -->