Last active
February 20, 2017 09:04
-
-
Save wpsmith/4586395 to your computer and use it in GitHub Desktop.
Add Nagging Menu to WordPress Site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'wps_register_nagging_script' ); | |
/** | |
* Register Nagging script | |
* | |
* @uses CHILD_THEME_VERSION set this via wp_get_theme()->Version | |
* @link https://gist.github.com/4477270 Sets Child Theme Constants via wp_get_theme() | |
* @link https://gist.github.com/4083811 For jQuery alternative to be placed in footer | |
*/ | |
function wps_nagging_script() { | |
$suffix = ( WP_DEBUG || SCRIPT_DEBUG ) ? '.js' : '.min.js'; | |
wp_enqueue_script( | |
'nagging-menu', | |
get_stylesheet_directory_uri() . '/js/nagging-menu' . $suffix, | |
array( 'jquery' ), | |
CHILD_THEME_VERSION, // I set this via wp_get_theme()->Version, @link https://gist.github.com/4477270 | |
true | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'wps_register_nagging_script' ); | |
/** | |
* Register Nagging script | |
* | |
* @uses CHILD_THEME_VERSION set this via wp_get_theme()->Version | |
* @link https://gist.github.com/4477270 Sets Child Theme Constants via wp_get_theme() | |
* @link https://gist.github.com/4083811 For jQuery alternative to be placed in footer | |
*/ | |
function wps_register_nagging_script() { | |
$suffix = ( WP_DEBUG || SCRIPT_DEBUG ) ? '.js' : '.min.js'; | |
wp_register_script( | |
'nagging-menu', | |
get_stylesheet_directory_uri() . '/js/nagging-menu' . $suffix, | |
array( 'jquery' ), | |
CHILD_THEME_VERSION, // I set this via wp_get_theme()->Version, @link https://gist.github.com/4477270 | |
true | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'wps_nagging_script' ); | |
/** | |
* Enqueue Nagging script if on home/archive page | |
*/ | |
function wps_nagging_script() { | |
if ( is_home() || is_front_page() || is_archive() || is_tax() ) | |
wp_enqueue_script( 'nagging-menu' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nav .fixed, | |
#subnav .fixed, | |
.fixed { | |
background: rgb(0,0,0); /* Fallback */ | |
background: rgba(0,0,0,0.97); /* All modern browsers */ | |
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#00000000'); /* IE */ | |
-webkit-box-shadow: 0 0 40px #222; | |
-moz-box-shadow: 0 0 40px #222; | |
box-shadow: 0 0 40px #222; | |
left: 0; | |
top: 0; | |
position: fixed; | |
width: 100%; | |
} | |
#nav .default, | |
#subnav .default, | |
.default { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment