Advertisement
catchmahesh

catchbox_pro_header_image_inbetween

Jul 21st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.10 KB | None | 0 0
  1. <?php
  2. function catchbox_main_header_image_position() {
  3.     // Getting data from Theme Options
  4.     $options  = catchbox_get_options();
  5.     $position = $options['header_image_position'];
  6.  
  7.  
  8.     if ( 'above' == $position ) {
  9.         add_action( 'catchbox_child_after_primary_menu', 'catchbox_main_header_image', 10 );
  10.     }
  11.     elseif ( 'below' == $position ) {
  12.         add_action( 'catchbox_after_headercontent', 'catchbox_main_header_image', 10 );
  13.     }
  14. }
  15.  
  16. function catchbox_header_menu() {
  17.     //Getting Ready to load options data
  18.     $options = catchbox_get_options();
  19.     $classes = "mobile-menu-anchor page-menu";
  20.  
  21.     // Header Left Mobile Menu Anchor
  22.     if ( has_nav_menu( 'primary' ) ) {
  23.         $classes = "mobile-menu-anchor primary-menu";
  24.     }
  25.     ?>
  26.     <div class="menu-access-wrap mobile-header-menu clearfix">
  27.         <?php if ( empty ($options['disable_responsive'] ) ) { ?>
  28.             <div id="mobile-header-left-menu" class="<?php echo $classes; ?>">
  29.                 <?php
  30.                 $hide_mobile_menu_labels = isset( $options['hide_mobile_menu_labels'] ) ? $options['hide_mobile_menu_labels'] : 0;
  31.  
  32.                 $label = isset( $options['primary_mobile_menu_label'] ) ? $options['primary_mobile_menu_label'] : esc_html__( 'Menu', 'catch-box-pro' );
  33.  
  34.                 $labelclass = "mobile-menu-text";
  35.  
  36.                 if ( !empty ( $hide_mobile_menu_labels ) ) {
  37.                     $labelclass = "screen-reader-text";
  38.                 }
  39.                 ?>
  40.                 <a href="#mobile-header-left-nav" id="menu-toggle-primary" class="genericon genericon-menu">
  41.                     <span class="<?php echo esc_attr( $labelclass ); ?>"><?php echo esc_attr( $label ); ?></span>
  42.                 </a>
  43.             </div><!-- #mobile-header-left-menu -->
  44.  
  45.             <?php
  46.             if ( !empty ($options['enable_sec_menu'] ) && has_nav_menu( 'secondary', 'catch-box-pro' ) ) :
  47.                     $menuclass = "mobile-enable"; ?>
  48.                     <div id="mobile-header-right-menu" class="mobile-menu-anchor secondary-menu">
  49.                         <?php
  50.                         $hide_mobile_menu_labels = isset( $options['hide_mobile_menu_labels'] ) ? $options['hide_mobile_menu_labels'] : 0;
  51.                         $label = isset( $options['secondary_mobile_menu_label'] ) ? $options['secondary_mobile_menu_label'] : esc_html__( 'Secondary Menu', 'catch-box-pro' );
  52.                         $labelclass = "mobile-menu-text";
  53.                         if ( !empty ( $hide_mobile_menu_labels ) ) {
  54.                             $labelclass = "screen-reader-text";
  55.                         }
  56.                         ?>
  57.                         <a href="#mobile-header-right-nav" id="menu-toggle-secondary" class="genericon genericon-menu">
  58.                             <span class="<?php echo $labelclass; ?>"><?php echo esc_attr( $label ); ?></span>
  59.                         </a>
  60.                     </div><!-- #mobile-header-right-menu -->
  61.                 <?php else :
  62.                     $menuclass = "mobile-disable";
  63.                 endif; ?>
  64.         <?php } ?>
  65.  
  66.         <div id="site-header-menu-primary" class="site-header-menu">
  67.             <nav id="access" class="main-navigation menu-focus" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'catch-box-pro' ); ?>">
  68.                 <h3 class="screen-reader-text"><?php _e( 'Primary menu', 'catch-box-pro' ); ?></h3>
  69.                 <?php
  70.                     if ( has_nav_menu( 'primary', 'catch-box-pro' ) ) {
  71.                         $args = array(
  72.                             'theme_location'    => 'primary',
  73.                             'container_class'   => 'menu-header-container',
  74.                             'items_wrap'        => '<ul class="menu">%3$s</ul>'
  75.                         );
  76.                         wp_nav_menu( $args );
  77.                     }
  78.                     else {
  79.                         echo '<div class="menu-header-container">';
  80.                             wp_page_menu( array( 'menu_class'  => 'menu' ) );
  81.                         echo '</div>';
  82.                     }
  83.                 ?>
  84.             </nav><!-- #access -->
  85.         </div><!-- .site-header-menu -->
  86.  
  87.         <?php do_action( 'catchbox_child_after_primary_menu' ); ?>
  88.  
  89.         <?php if ( has_nav_menu( 'secondary' ) ) { ?>
  90.             <div id="site-header-menu-secondary" class="site-header-menu">
  91.                 <nav id="access-secondary" class="<?php echo $menuclass; ?>"  role="navigation" aria-label="<?php esc_attr_e( 'Secondary Menu', 'catch-box-pro' ); ?>">
  92.                     <h3 class="screen-reader-text"><?php _e( 'Secondary menu', 'catch-box-pro' ); ?></h3>
  93.                     <?php wp_nav_menu( array( 'theme_location'  => 'secondary', 'container_class' => 'menu-secondary-container' ) );  ?>
  94.                 </nav><!-- #access-secondary -->
  95.             </div><!-- .site-header-menu -->
  96.         <?php } ?>
  97.     </div><!-- .menu-access-wrap -->
  98. <?php
  99. }
  100.  
  101.  
  102. function catchbox_child_remove_header_action(){
  103.     remove_action( 'catchbox_before_headercontent', 'catchbox_main_header_image', 10 );
  104. }
  105.  
  106. add_action( 'init', 'catchbox_child_remove_header_action' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement