header.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php declare( strict_types = 1 ); ?>
  2. <?php
  3. /**
  4. * The header for our theme
  5. *
  6. * This is the template that displays all of the <head> section and everything up until <div id="content">
  7. *
  8. * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
  9. *
  10. * @package WordPress
  11. * @subpackage Twenty_Nineteen
  12. * @since 1.0.0
  13. */
  14. ?><!doctype html>
  15. <html <?php language_attributes(); ?>>
  16. <head>
  17. <meta charset="<?php bloginfo( 'charset' ); ?>" />
  18. <meta name="viewport" content="width=device-width, initial-scale=1" />
  19. <link rel="profile" href="https://gmpg.org/xfn/11" />
  20. <?php wp_head(); ?>
  21. </head>
  22. <body <?php body_class(); ?>>
  23. <?php wp_body_open(); ?>
  24. <div id="page" class="site">
  25. <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentynineteen' ); ?></a>
  26. <header id="masthead" class="<?php echo is_singular() && twentynineteen_can_show_post_thumbnail() ? 'site-header featured-image' : 'site-header'; ?>">
  27. <div class="site-branding-container">
  28. <?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
  29. </div><!-- .site-branding-container -->
  30. <?php if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) : ?>
  31. <div class="site-featured-image">
  32. <?php
  33. twentynineteen_post_thumbnail();
  34. the_post();
  35. $discussion = ! is_page() && twentynineteen_can_show_post_thumbnail() ? twentynineteen_get_discussion_data() : null;
  36. $classes = 'entry-header';
  37. if ( ! empty( $discussion ) && absint( $discussion->responses ) > 0 ) {
  38. $classes = 'entry-header has-discussion';
  39. }
  40. ?>
  41. <div class="<?php echo $classes; ?>">
  42. <?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
  43. </div><!-- .entry-header -->
  44. <?php rewind_posts(); ?>
  45. </div>
  46. <?php endif; ?>
  47. </header><!-- #masthead -->
  48. <div id="content" class="site-content">