Skip to content

Instantly share code, notes, and snippets.

@riceguitar
Last active August 3, 2017 19:20
Show Gist options
  • Save riceguitar/77eb1850cc343700c1ff1f36f58e6dfa to your computer and use it in GitHub Desktop.
Save riceguitar/77eb1850cc343700c1ff1f36f58e6dfa to your computer and use it in GitHub Desktop.
<?php
// Creates New Nav/Menus
register_nav_menus( array(
'desktop_large' => 'Primary Large Desktop Menu',
'desktop_small' => 'Smaller Desktop Menu',
));
// Places the HTML high up into the DOM
function desktop_nav() {
echo '
<a href="#" class="desktop-menu-toggle">Toggle Menu</a>
<div class="desktop-menu-wrap">
<div class="desktop-menu-large">
';
wp_nav_menu( array(
'theme_location' => 'desktop_large'
));
echo '
</div>
<div class="desktop-menu-small">
';
wp_nav_menu( array(
'theme_location' => 'desktop_small'
));
echo '
</div>
</div>';
}
add_action('fl_body_open', 'desktop_nav');
// Loads the JS needed to toggle the menu
function desktop_nav_script() {
wp_enqueue_script( 'desktop-js', get_stylesheet_directory_uri() . '/js/desktop-nav.js', array( 'jquery' ) );
wp_enqueue_style( 'desktop-css', get_stylesheet_directory_uri() . '/css/desktop-nav.css' );
}
add_action( 'wp_enqueue_scripts', 'desktop_nav_script' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment