martcol

Reactor content-header.php

Nov 3rd, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.69 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Header Content
  4.  * hook in the content for header.php
  5.  *
  6.  * @package Reactor
  7.  * @author Anthony Wilhelm (@awshout / anthonywilhelm.com)
  8.  * @since 1.0.0
  9.  * @link http://codex.wordpress.org/Function_Reference/register_sidebar
  10.  * @license GNU General Public License v2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
  11.  */
  12.  
  13. /**
  14.  * Site meta, title, and favicon
  15.  * in header.php
  16.  *
  17.  * @since 1.0.0
  18.  */
  19. function reactor_do_reactor_head() { ?>
  20. <meta charset="<?php bloginfo('charset'); ?>" />
  21. <title><?php wp_title('|', true, 'right'); ?></title>
  22.  
  23. <!-- google chrome frame for ie -->
  24. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  25.    
  26. <!-- mobile meta -->
  27. <meta name="HandheldFriendly" content="True">
  28. <meta name="MobileOptimized" content="320">
  29. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  30.  
  31. <?php $favicon_uri = reactor_option('favicon_image') ? reactor_option('favicon_image') : get_template_directory_uri() . '/favicon.ico'; ?>
  32. <link rel="shortcut icon" href="<?php echo $favicon_uri; ?>">
  33. <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
  34.  
  35. <?php
  36. }
  37. add_action('wp_head', 'reactor_do_reactor_head', 1);
  38.  
  39. /**
  40.  * Top bar
  41.  * in header.php
  42.  *
  43.  * @since 1.0.0
  44. */
  45. function reactor_do_top_bar() {
  46.     if ( has_nav_menu('top-bar-l') || has_nav_menu('top-bar-r') ) {
  47.         $topbar_args = array(
  48.             'title'     => reactor_option('topbar_title', get_bloginfo('name')),
  49.             'title_url' => reactor_option('topbar_title_url', home_url()),
  50.             'fixed'     => reactor_option('topbar_fixed', 0),
  51.             'contained' => reactor_option('topbar_contain', 1),
  52.         );
  53.         reactor_top_bar( $topbar_args );
  54.     }
  55. }
  56. add_action('reactor_header_before', 'reactor_do_top_bar', 1);
  57.  
  58. /**
  59.  * Site title, tagline, logo, and nav bar
  60.  * in header.php
  61.  *
  62.  * @since 1.0.0
  63.  */
  64. function reactor_do_title_logo() { ?>
  65.     <div class="inner-header">
  66.         <div class="row">
  67.             <div class="column">
  68.                 <?php if ( reactor_option('logo_image') ) : ?>
  69.                 <div class="site-logo large-4 small-12">
  70.                     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
  71.                         <img src="<?php echo reactor_option('logo_image') ?>" alt="<?php echo esc_attr( get_bloginfo('name', 'display') ); ?> logo">
  72.                     </a>
  73.                 </div><!-- .site-logo -->
  74.                 <?php endif; // end if logo ?>
  75.                 <div class="title-area small-12 large-8">
  76.                     <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo('name'); ?></a></p>
  77.                     <p class="site-description"><?php bloginfo('description'); ?></p>
  78.                 </div>
  79.             </div><!-- .column -->
  80.         </div><!-- .row -->
  81.     </div><!-- .inner-header -->  
  82. <?php
  83. }
  84. add_action('reactor_header_inside', 'reactor_do_title_logo', 1);
  85.  
  86. /**
  87.  * Nav bar and mobile nav button
  88.  * in header.php
  89.  *
  90.  * @since 1.0.0
  91.  */
  92. function reactor_do_nav_bar() {
  93.     if ( has_nav_menu('main-menu') ) {
  94.         $nav_class = ( reactor_option('mobile_menu', 1) ) ? 'class="hide-for-small" ' : ''; ?>
  95.         <div class="main-nav">
  96.             <nav id="menu" <?php echo $nav_class; ?>role="navigation">
  97.                 <div class="section-container horizontal-nav" data-section="horizontal-nav" data-options="one_up:false;">
  98.                     <?php reactor_main_menu(); ?>
  99.                 </div>
  100.             </nav>
  101.         </div><!-- .main-nav -->
  102.        
  103.     <?php  
  104.     if ( reactor_option('mobile_menu', 1) ) { ?>      
  105.         <div class="row"> <!-- Martin added these two divs -->
  106.                 <div class="<?php reactor_columns( 12 ); ?>">
  107. <div id="mobile-menu-button" class="show-for-small">
  108.             <button class="secondary button" id="mobileMenuButton" href="#mobile-menu">
  109.                 <span class="mobile-menu-icon"></span> <!--Martin changed div to span (validation problem with div inside button) -->
  110.                 <span class="mobile-menu-icon"></span>
  111.                 <span class="mobile-menu-icon"></span>
  112.             </button>
  113.         </div><!-- #mobile-menu-button -->
  114.         </div><!-- .columns -->
  115.             </div><!-- .row -->          
  116.     <?php }
  117.     }
  118. }
  119. add_action('reactor_header_after', 'reactor_do_nav_bar', 1);  // Martin changed the hook from reactor_header_inside to reactor_header_after and priority to 1
  120.  
  121. /**
  122.  * Mobile nav
  123.  * in header.php
  124.  *
  125.  * @since 1.0.0
  126.  */
  127. function reactor_do_mobile_nav() {
  128.     if ( reactor_option('mobile_menu', 1) && has_nav_menu('main-menu') ) { ?>
  129.         <nav id="mobile-menu" class="show-for-small" role="navigation">
  130.             <div class="section-container accordion" data-section="accordion" data-options="one_up:false">
  131.                 <?php reactor_main_menu(); ?>
  132.             </div>
  133.         </nav>
  134. <?php }
  135. }
  136. add_action('reactor_header_after', 'reactor_do_mobile_nav', 2);  // Martin changed the priority to 2
  137.  
  138. ?>
Advertisement
Add Comment
Please, Sign In to add comment