Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Created January 19, 2020 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damiencarbery/1b4457f1103fd761acc66ffd7cb2327d to your computer and use it in GitHub Desktop.
Save damiencarbery/1b4457f1103fd761acc66ffd7cb2327d to your computer and use it in GitHub Desktop.
Use ShiftNav with Genesis Sample theme - Replace Genesis Sample responsive menu with ShiftNav plugin. https://www.damiencarbery.com/2020/01/use-shiftnav-with-genesis-sample-theme/
<?php
/*
Plugin Name: ShiftNav with Genesis Sample
Plugin URI: https://www.damiencarbery.com/2020/01/use-shiftnav-with-genesis-sample-theme/
Description: Replace Genesis Sample responsive menu with ShiftNav plugin.
Author: Damien Carbery
Version: 0.1
*/
// Don't need responsive menu because we are using ShiftNav to show the menu on mobile.
add_action( 'wp_enqueue_scripts', 'dcwd_disable_responsive_menu', 15 );
function dcwd_disable_responsive_menu() {
if ( class_exists( 'ShiftNav' ) ) {
wp_dequeue_script( 'genesis-sample-responsive-menu' );
}
}
// Manually add the ShiftNav toggle.
// The markup is as given in the ShiftNav/Main ShiftNav Settings with 'menu-toggle' class
// added to make use of the Genesis Sample CSS that will show/hide the toggle at 960px.
//add_action( 'genesis_header', 'dcwd_mobile_menu_toggle' );
add_action( 'genesis_header_right', 'dcwd_mobile_menu_toggle', 15 );
function dcwd_mobile_menu_toggle() {
echo '<a class="menu-toggle shiftnav-toggle shiftnav-toggle-button" data-shiftnav-target="shiftnav-main"><i class="fa fa-bars"></i> Menu</a>';
// If you disable "Load Font Awesome" you can tweak the link class to use Dashicons (which is already loaded).
//echo '<a class="menu-toggle dashicons-before dashicons-menu shiftnav-toggle shiftnav-toggle-button" data-shiftnav-target="shiftnav-main">Menu</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment