SHARE
TWEET

new-menu-php

a guest Apr 26th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function register_my_menu() {
  2. register_nav_menu('new-menu',__( 'New Menu' ));
  3. }
  4. add_action( 'init', 'register_my_menu' );
  5.  
  6. if ( ! function_exists( 'nepalbuzz_new_menu' ) ) :
  7. /**
  8.  * Shows the New Menu
  9.  *
  10.  * default load in sidebar-header-right.php
  11.  */
  12. function nepalbuzz_new_menu() {
  13.     $options  = nepalbuzz_get_options();
  14.  
  15.     if ( $options['primary_menu_disable'] ) {
  16.         // Bail if primary menu is disabled.
  17.         return;
  18.     }
  19.     ?>
  20.  
  21.     <button id="menu-toggle-primary-new" class="menu-toggle"><span class="menu-label"><?php esc_html_e( 'Menu', 'nepalbuzz-pro' ); ?></span></button>
  22.     <div id="primary-menu-new">
  23.         <div class="wrapper">
  24.             <div id="site-header-menu-new" class="menu-primary">
  25.                 <nav id="site-navigation" class="main-navigation nav-primary <?php echo ( !$options['primary_search_disable']  ) ? 'search-enabled' : '';?>" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'nepalbuzz-pro' ); ?>">
  26.                     <h3 class="screen-reader-text"><?php _e( 'Primary menu', 'nepalbuzz-pro' ); ?></h3>
  27.                     <?php
  28.                         if ( has_nav_menu( 'primary' ) ) {
  29.                             $args = array(
  30.                                 'theme_location'    => 'new-menu',
  31.                                 'menu_class'        => 'menu nepalbuzz-nav-menu',
  32.                                 'container'         => false
  33.                             );
  34.                             wp_nav_menu( $args );
  35.                         }
  36.                         else {
  37.                             wp_page_menu( array( 'menu_class'  => 'default-page-menu' ) );
  38.                         }
  39.                         if( !$options['primary_search_disable'] ) :
  40.                             ?>
  41.                             <div id="search-toggle">
  42.                                 <a class="screen-reader-text" href="#search-container"><?php esc_html_e( 'Search', 'nepalbuzz-pro' ); ?></a>
  43.                             </div>
  44.  
  45.                             <div id="search-container" class="displaynone">
  46.                                 <?php get_Search_form(); ?>
  47.                             </div>
  48.                             <?php
  49.                         endif;
  50.                     ?>
  51.                 </nav><!-- .nav-primary -->
  52.             </div><!-- #site-header-menu -->
  53.         </div><!-- .wrapper -->
  54.     </div><!-- #primary-menu-wrapper -->
  55.     <?php
  56. }
  57. endif; //nepalbuzz_primary_menu
  58. add_action( 'nepalbuzz_header', 'nepalbuzz_new_menu', 30 );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top