[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwentyone/template-parts/header/ -> site-branding.php (source)

   1  <?php
   2  /**
   3   * Displays header site branding
   4   *
   5   * @package WordPress
   6   * @subpackage Twenty_Twenty_One
   7   * @since Twenty Twenty-One 1.0
   8   */
   9  
  10  $blog_info    = get_bloginfo( 'name' );
  11  $description  = get_bloginfo( 'description', 'display' );
  12  $show_title   = ( true === get_theme_mod( 'display_title_and_tagline', true ) );
  13  $header_class = $show_title ? 'site-title' : 'screen-reader-text';
  14  
  15  ?>
  16  
  17  <?php if ( has_custom_logo() && $show_title ) : ?>
  18      <div class="site-logo"><?php the_custom_logo(); ?></div>
  19  <?php endif; ?>
  20  
  21  <div class="site-branding">
  22  
  23      <?php if ( has_custom_logo() && ! $show_title ) : ?>
  24          <div class="site-logo"><?php the_custom_logo(); ?></div>
  25      <?php endif; ?>
  26  
  27      <?php if ( $blog_info ) : ?>
  28          <?php if ( is_front_page() && ! is_paged() ) : ?>
  29              <h1 class="<?php echo esc_attr( $header_class ); ?>"><?php echo esc_html( $blog_info ); ?></h1>
  30          <?php elseif ( is_front_page() || is_home() ) : ?>
  31              <h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></h1>
  32          <?php else : ?>
  33              <p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></p>
  34          <?php endif; ?>
  35      <?php endif; ?>
  36  
  37      <?php if ( $description && get_theme_mod( 'display_title_and_tagline', true ) === true ) : ?>
  38          <p class="site-description">
  39              <?php echo $description; // phpcs:ignore WordPress.Security.EscapeOutput ?>
  40          </p>
  41      <?php endif; ?>
  42  </div><!-- .site-branding -->


Generated: Sun Jan 17 01:00:03 2021 Cross-referenced by PHPXref 0.7.1