header.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * The header for our theme.
  4. *
  5. * Displays all of the <head> section and everything up till <div id="content">
  6. *
  7. * @package Libre 2
  8. */
  9. ?><!DOCTYPE html>
  10. <html <?php language_attributes(); ?>>
  11. <head>
  12. <meta charset="<?php bloginfo( 'charset' ); ?>">
  13. <meta name="viewport" content="width=device-width, initial-scale=1">
  14. <link rel="profile" href="http://gmpg.org/xfn/11">
  15. <?php wp_head(); ?>
  16. </head>
  17. <body <?php body_class(); ?>>
  18. <div class="site-wrapper">
  19. <div id="page" class="hfeed site">
  20. <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'libre-2' ); ?></a>
  21. <?php if ( get_header_image() ) : ?>
  22. <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
  23. <img src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" class="custom-header">
  24. </a>
  25. <?php endif; // End header image check. ?>
  26. <header id="masthead" class="site-header" role="banner">
  27. <div class="site-branding">
  28. <?php if ( function_exists( 'the_custom_logo' ) ) : ?>
  29. <?php the_custom_logo(); ?>
  30. <?php endif; ?>
  31. <?php if ( is_front_page() && is_home() ) : ?>
  32. <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
  33. <?php else : ?>
  34. <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
  35. <?php endif;
  36. $description = get_bloginfo( 'description', 'display' );
  37. if ( $description || is_customize_preview() ) : ?>
  38. <p class="site-description"><?php echo $description; ?></p>
  39. <?php endif; ?>
  40. </div><!-- .site-branding -->
  41. <div class="nav-wrapper">
  42. <nav id="site-navigation" class="main-navigation" role="navigation">
  43. <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">&#9776; <?php esc_html_e( 'Menu', 'libre-2' ); ?></button>
  44. <?php wp_nav_menu( array( 'theme_location' => 'menu-1', 'menu_id' => 'primary-menu' ) ); ?>
  45. <?php libre_2_social_menu(); ?>
  46. </nav><!-- #site-navigation -->
  47. <?php // Add Woocommerce Cart to header if Woocommerce exists
  48. if ( class_exists( 'WooCommerce' ) ) {
  49. libre_2_woocommerce_header_cart();
  50. }
  51. ?>
  52. </div>
  53. </header><!-- #masthead -->
  54. <div id="content" class="site-content">