Initial commit
This commit is contained in:
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) exit;
|
||||
|
||||
if ( ! class_exists( 'GeneratePress_Secondary_Nav_CSS' ) ) :
|
||||
class GeneratePress_Secondary_Nav_CSS {
|
||||
|
||||
protected $_selector = '';
|
||||
protected $_selector_output = '';
|
||||
protected $_css = '';
|
||||
protected $_output = '';
|
||||
|
||||
public function set_selector( $selector = '' )
|
||||
{
|
||||
// Render the css in the output string everytime the selector changes
|
||||
if( $this->_selector !== '' ){
|
||||
$this->add_selector_rules_to_output();
|
||||
}
|
||||
$this->_selector = $selector;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function add_property( $property, $value, $og_default = false, $unit = false )
|
||||
{
|
||||
// Add our unit to the value if it exists
|
||||
if ( $unit && '' !== $unit ) {
|
||||
$value = $value . $unit;
|
||||
if ( '' !== $og_default ) {
|
||||
$og_default = $og_default . $unit;
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't have a value or our value is the same as our og default, bail
|
||||
if ( empty( $value ) || $og_default == $value )
|
||||
return false;
|
||||
|
||||
$this->_css .= $property . ':' . $value . ';';
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function add_selector_rules_to_output()
|
||||
{
|
||||
if( !empty( $this->_css ) ) {
|
||||
$this->_selector_output = $this->_selector;
|
||||
$selector_output = sprintf( '%1$s{%2$s}', $this->_selector_output, $this->_css );
|
||||
|
||||
$this->_output .= $selector_output;
|
||||
|
||||
// Reset the css
|
||||
$this->_css = '';
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function css_output()
|
||||
{
|
||||
// Add current selector's rules to output
|
||||
$this->add_selector_rules_to_output();
|
||||
|
||||
// Output minified css
|
||||
return $this->_output;
|
||||
}
|
||||
|
||||
}
|
||||
endif;
|
@ -0,0 +1,103 @@
|
||||
.secondary-navigation.toggled ul ul {
|
||||
transition: 0s;
|
||||
}
|
||||
|
||||
.dropdown-hover .secondary-navigation.toggled ul li:hover > ul,
|
||||
.dropdown-hover .secondary-navigation.toggled ul li.sfHover > ul {
|
||||
transition-delay: 0s;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled ul ul {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled ul ul.toggled-on {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .main-nav ul ul.toggled-on {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: auto !important;
|
||||
right: auto !important;
|
||||
width: 100%;
|
||||
pointer-events: auto;
|
||||
height: auto;
|
||||
opacity: 1;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .main-nav > ul {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .main-nav ul ul {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .main-nav .sf-menu > li {
|
||||
float: none;
|
||||
clear: both;
|
||||
display: block !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .main-nav .sf-menu > li.hide-on-mobile {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .dropdown-menu-toggle:before {
|
||||
content: "\f107" !important;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .sfHover > a .dropdown-menu-toggle:before {
|
||||
content: "\f106" !important;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .menu-item-has-children .dropdown-menu-toggle {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.secondary-navigation.toggled .sf-menu > li.menu-item-float-right {
|
||||
float: none !important;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.rtl .secondary-navigation.toggled .main-nav .sf-menu > li {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.secondary-navigation .menu-toggle {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.secondary-navigation ul {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-left .secondary-navigation .top-bar {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-left .secondary-navigation .top-bar + .menu-toggle {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right .secondary-navigation .top-bar {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right .secondary-navigation .top-bar + .menu-toggle {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-center .secondary-navigation .top-bar + .menu-toggle + div {
|
||||
display: block;
|
||||
}
|
||||
}
|
1
wp-content/plugins/gp-premium/secondary-nav/functions/css/mobile.min.css
vendored
Normal file
1
wp-content/plugins/gp-premium/secondary-nav/functions/css/mobile.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.secondary-navigation.toggled ul ul{transition:0s;visibility:hidden}.dropdown-hover .secondary-navigation.toggled ul li.sfHover>ul,.dropdown-hover .secondary-navigation.toggled ul li:hover>ul{transition-delay:0s}.secondary-navigation.toggled ul ul.toggled-on{visibility:visible}.secondary-navigation.toggled .main-nav ul ul.toggled-on{position:relative;top:0;left:auto!important;right:auto!important;width:100%;pointer-events:auto;height:auto;opacity:1;display:block}.secondary-navigation.toggled .main-nav>ul{display:block}.secondary-navigation.toggled .main-nav ul ul{position:relative;top:0;left:0;width:100%}.secondary-navigation.toggled .main-nav .sf-menu>li{float:none;clear:both;display:block!important;text-align:left!important}.secondary-navigation.toggled .main-nav .sf-menu>li.hide-on-mobile{display:none!important}.secondary-navigation.toggled .dropdown-menu-toggle:before{content:"\f107"!important}.secondary-navigation.toggled .sfHover>a .dropdown-menu-toggle:before{content:"\f106"!important}.secondary-navigation.toggled .menu-item-has-children .dropdown-menu-toggle{float:right}.secondary-navigation.toggled .sf-menu>li.menu-item-float-right{float:none!important;display:inline-block}.rtl .secondary-navigation.toggled .main-nav .sf-menu>li{text-align:right!important}@media (max-width:768px){.secondary-nav-aligned-center .secondary-navigation .top-bar+.menu-toggle+div,.secondary-navigation .menu-toggle{display:block}.secondary-navigation ul{display:none}.secondary-nav-aligned-left .secondary-navigation .top-bar{position:absolute;right:0}.secondary-nav-aligned-left .secondary-navigation .top-bar+.menu-toggle{text-align:left}.secondary-nav-aligned-right .secondary-navigation .top-bar{position:absolute;left:0}.secondary-nav-aligned-right .secondary-navigation .top-bar+.menu-toggle{text-align:right}}
|
@ -0,0 +1,349 @@
|
||||
.secondary-navigation {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.secondary-navigation ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.secondary-navigation li {
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.secondary-navigation a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.secondary-navigation ul ul {
|
||||
display: block;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
|
||||
float: left;
|
||||
position: absolute;
|
||||
left: -99999px;
|
||||
opacity: 0;
|
||||
z-index: 99999;
|
||||
width: 200px;
|
||||
text-align: left;
|
||||
top: auto;
|
||||
transition: opacity 80ms linear;
|
||||
transition-delay: 0s;
|
||||
pointer-events: none;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.secondary-navigation ul ul li {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.secondary-navigation.sub-menu-left .sub-menu {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.dropdown-hover .secondary-navigation:not(.toggled) ul li:hover > ul,
|
||||
.dropdown-hover .secondary-navigation:not(.toggled) ul li.sfHover > ul {
|
||||
left: auto;
|
||||
opacity: 1;
|
||||
transition-delay: 150ms;
|
||||
pointer-events: auto;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.dropdown-hover .secondary-navigation:not(.toggled) ul ul li:hover > ul,
|
||||
.dropdown-hover .secondary-navigation:not(.toggled) ul ul li.sfHover > ul {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.dropdown-hover .secondary-navigation.sub-menu-left:not(.toggled) ul ul li:hover > ul,
|
||||
.dropdown-hover .secondary-navigation.sub-menu-left:not(.toggled) ul ul li.sfHover > ul {
|
||||
right: 100%;
|
||||
top: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
.secondary-nav-float-right .secondary-navigation {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.secondary-navigation .main-nav ul ul li a,
|
||||
.secondary-nav-float-right .secondary-navigation .main-nav ul ul li a {
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.secondary-nav-float-right .secondary-navigation ul ul ul{
|
||||
top: 0
|
||||
}
|
||||
|
||||
.secondary-nav-float-left .inside-header .secondary-navigation {
|
||||
float: left;
|
||||
clear: left;
|
||||
}
|
||||
|
||||
.secondary-nav-float-left:not(.nav-float-right) .inside-header .site-branding,
|
||||
.secondary-nav-float-left:not(.nav-float-right) .inside-header .site-logo {
|
||||
float: right;
|
||||
clear: right;
|
||||
}
|
||||
|
||||
.secondary-nav-float-left.nav-float-right .inside-header .site-branding,
|
||||
.secondary-nav-float-left.nav-float-right .inside-header .site-logo,
|
||||
.nav-float-left.secondary-nav-float-right .inside-header .site-branding,
|
||||
.nav-float-left.secondary-nav-float-right .inside-header .site-logo {
|
||||
float: none;
|
||||
clear: none;
|
||||
}
|
||||
|
||||
.secondary-nav-float-left .inside-header:after {
|
||||
clear: both;
|
||||
content: '';
|
||||
display: table;
|
||||
}
|
||||
|
||||
.secondary-nav-float-left.nav-float-right .site-header,
|
||||
.nav-float-left.secondary-nav-float-right .site-header {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.secondary-navigation {
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.secondary-navigation {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.secondary-navigation .menu-toggle {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.secondary-navigation ul ul li a {
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.secondary-navigation ul ul li a {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.widget-area .secondary-navigation li {
|
||||
display: block;
|
||||
float: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.widget-area .secondary-navigation ul ul {
|
||||
left: 100%;
|
||||
top: 0;
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.both-right .widget-area .secondary-navigation ul ul,
|
||||
.right-sidebar .widget-area .secondary-navigation ul ul,
|
||||
.both-sidebars .widget-area .inside-right-sidebar .secondary-navigation ul ul {
|
||||
left: auto;
|
||||
right: 100%;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right.secondary-nav-below-header .secondary-navigation .sf-menu > li,
|
||||
.secondary-nav-aligned-right.secondary-nav-above-header .secondary-navigation .sf-menu > li,
|
||||
.secondary-nav-aligned-center.secondary-nav-below-header .secondary-navigation .sf-menu > li,
|
||||
.secondary-nav-aligned-center.secondary-nav-above-header .secondary-navigation .sf-menu > li {
|
||||
float: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right .secondary-navigation ul,
|
||||
.secondary-nav-aligned-center .secondary-navigation ul {
|
||||
font-size: 0px;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-left.secondary-nav-below-header .secondary-navigation,
|
||||
.secondary-nav-aligned-left.secondary-nav-above-header .secondary-navigation {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-center.secondary-nav-below-header .secondary-navigation,
|
||||
.secondary-nav-aligned-center.secondary-nav-above-header .secondary-navigation {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right.secondary-nav-below-header .secondary-navigation,
|
||||
.secondary-nav-aligned-right.secondary-nav-above-header .secondary-navigation {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dropdown-click .secondary-navigation ul ul {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.dropdown-click .secondary-navigation ul.toggled-on,
|
||||
.dropdown-click .secondary-navigation ul li.sfHover > ul.toggled-on {
|
||||
left: auto;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
pointer-events: auto;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.dropdown-click .secondary-navigation ul ul ul.toggled-on {
|
||||
left: 0;
|
||||
top: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dropdown-click.both-right .widget-area .secondary-navigation ul ul,
|
||||
.dropdown-click.right-sidebar .widget-area .secondary-navigation ul ul,
|
||||
.dropdown-click.both-sidebars .widget-area .inside-right-sidebar .secondary-navigation ul ul {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.dropdown-click .widget-area .secondary-navigation ul ul {
|
||||
top: auto;
|
||||
position: absolute;
|
||||
float: none;
|
||||
width: 100%;
|
||||
left: -99999px;
|
||||
}
|
||||
|
||||
.dropdown-click .widget-area .secondary-navigation ul ul.toggled-on {
|
||||
position: relative;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.secondary-navigation .main-nav ul li.menu-item-has-children > a {
|
||||
padding-right: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.widget-area .secondary-navigation li {
|
||||
float: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.dropdown-hover .widget-area .secondary-navigation:not(.toggled) ul li:hover ul,
|
||||
.dropdown-hover .widget-area .secondary-navigation:not(.toggled) ul li.sfHover > ul {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
width:220px;
|
||||
}
|
||||
|
||||
.dropdown-hover.both-right .widget-area .secondary-navigation:not(.toggled) ul li:hover ul,
|
||||
.dropdown-hover.both-right .widget-area .secondary-navigation:not(.toggled) ul li.sfHover ul,
|
||||
.dropdown-hover.right-sidebar .widget-area .secondary-navigation:not(.toggled) ul li:hover ul,
|
||||
.dropdown-hover.right-sidebar .widget-area .secondary-navigation:not(.toggled) ul li.sfHover ul,
|
||||
.dropdown-hover.both-sidebars .widget-area .inside-right-sidebar .secondary-navigation:not(.toggled) ul li:hover ul,
|
||||
.dropdown-hover.both-sidebars .widget-area .inside-right-sidebar .secondary-navigation:not(.toggled) ul li.sfHover ul {
|
||||
right: 100%;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
.widget-area .secondary-navigation ul ul {
|
||||
top: 0;
|
||||
left: 100%;
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.rtl .secondary-navigation ul ul {
|
||||
float: right;
|
||||
left: auto;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.rtl .secondary-navigation ul ul ul {
|
||||
left: auto;
|
||||
right: 100%;
|
||||
}
|
||||
|
||||
.rtl .secondary-navigation .menu-item-has-children ul .dropdown-menu-toggle {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* Default styles */
|
||||
.widget-area .secondary-navigation {
|
||||
margin-bottom: 11px;
|
||||
}
|
||||
|
||||
.secondary-navigation ul ul {
|
||||
top: auto;
|
||||
}
|
||||
|
||||
.secondary-navigation .main-nav ul li a,
|
||||
.secondary-navigation .menu-toggle {
|
||||
font-family: inherit;
|
||||
font-weight: normal;
|
||||
text-transform: none;
|
||||
font-size: 13px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.secondary-navigation .main-nav ul ul li a {
|
||||
font-size: 12px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.secondary-navigation .menu-item-has-children ul .dropdown-menu-toggle {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.secondary-navigation .menu-item-has-children .dropdown-menu-toggle {
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
/* Top bar */
|
||||
.secondary-navigation .top-bar {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.secondary-navigation .inside-top-bar {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.secondary-navigation .top-bar a {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right .secondary-navigation .top-bar {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-right .secondary-navigation .top-bar .inside-top-bar .widget {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-left .secondary-navigation .top-bar {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-left .secondary-navigation .top-bar .inside-top-bar .widget {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-center .secondary-navigation .top-bar,
|
||||
.secondary-nav-aligned-center .secondary-navigation .top-bar + .menu-toggle + div {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.secondary-nav-aligned-center .secondary-navigation .top-bar .widget:not(:first-child) {
|
||||
margin-left: 10px;
|
||||
}
|
1
wp-content/plugins/gp-premium/secondary-nav/functions/css/style.min.css
vendored
Normal file
1
wp-content/plugins/gp-premium/secondary-nav/functions/css/style.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1090
wp-content/plugins/gp-premium/secondary-nav/functions/functions.php
Normal file
1090
wp-content/plugins/gp-premium/secondary-nav/functions/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,148 @@
|
||||
(function( $ ){
|
||||
/**
|
||||
* Navigation width
|
||||
*/
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_nav_layout_setting]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( 'secondary-fluid-nav' == newval ) {
|
||||
$( '.secondary-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
|
||||
if ( 'full-width' !== wp.customize.value('generate_secondary_nav_settings[secondary_nav_inner_width]')() ) {
|
||||
$( '.secondary-navigation .inside-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
|
||||
}
|
||||
}
|
||||
if ( 'secondary-contained-nav' == newval ) {
|
||||
jQuery( '.secondary-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
|
||||
jQuery( '.secondary-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Inner navigation width
|
||||
*/
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_nav_inner_width]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
if ( 'full-width' == newval ) {
|
||||
$( '.secondary-navigation .inside-navigation' ).removeClass( 'grid-container' ).removeClass( 'grid-parent' );
|
||||
}
|
||||
if ( 'contained' == newval ) {
|
||||
$( '.secondary-navigation .inside-navigation' ).addClass( 'grid-container' ).addClass( 'grid-parent' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Navigation position
|
||||
*/
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_nav_position_setting]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
// Refresh if our top bar is in the secondary navigation and we're moving the secondary nav from above the header
|
||||
if ( ( $( '.secondary-navigation .top-bar' ).length || $( '.top-bar' ).next( '.secondary-navigation' ).length ) && 'secondary-nav-above-header' !== newval ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Refresh if our top bar exists and we're moving the secondary nav above the header
|
||||
if ( $( '.top-bar' ).length && 'secondary-nav-above-header' == newval ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Refresh if our secondary nav was in the sidebar
|
||||
if ( $( '.gen-sidebar-secondary-nav' ).length ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Refresh if we're moving the secondary nav into the left sidebar
|
||||
if ( 'secondary-nav-left-sidebar' == newval ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Refresh if we're moving the secondary nav into the right sidebar
|
||||
if ( 'secondary-nav-right-sidebar' == newval ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update our body classes depending on our setting
|
||||
var classes = [ 'secondary-nav-below-header', 'secondary-nav-above-header', 'secondary-nav-float-right', 'secondary-nav-float-left', 'secondary-nav-left-sidebar', 'secondary-nav-right-sidebar' ];
|
||||
if ( 'secondary-nav-left-sidebar' !== newval && 'secondary-nav-right-sidebar' !== newval ) {
|
||||
$.each( classes, function( i, v ) {
|
||||
$( 'body' ).removeClass( v );
|
||||
});
|
||||
}
|
||||
$( 'body' ).addClass( newval );
|
||||
|
||||
// Make sure we move the secondary nav below the primary nav if it's below the header
|
||||
if ( 'secondary-nav-below-header' == newval ) {
|
||||
if ( $( 'body' ).hasClass( 'nav-below-header' ) ) {
|
||||
$( '#secondary-navigation' ).insertAfter( '#site-navigation' ).show();
|
||||
} else {
|
||||
$( '#secondary-navigation' ).insertAfter( '.site-header' ).show();
|
||||
}
|
||||
}
|
||||
|
||||
// Insert our secondary nav before the header
|
||||
if ( 'secondary-nav-above-header' == newval ) {
|
||||
$( '#secondary-navigation' ).insertBefore( '.site-header' ).show();
|
||||
}
|
||||
|
||||
// Insert our nav into the header
|
||||
if ( 'secondary-nav-float-right' == newval ) {
|
||||
$( '#secondary-navigation' ).prependTo( '.inside-header' ).show();
|
||||
}
|
||||
if ( 'secondary-nav-float-left' == newval ) {
|
||||
$( '#secondary-navigation' ).appendTo( '.inside-header' ).show();
|
||||
}
|
||||
|
||||
// If we're hiding the secondary nav, either refresh or simply hide it
|
||||
if ( '' == newval ) {
|
||||
if ( $( '.gen-sidebar-secondary-nav' ).length ) {
|
||||
wp.customize.preview.send( 'refresh' );
|
||||
} else {
|
||||
$( '#secondary-navigation' ).hide();
|
||||
}
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_nav_alignment]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
var classes = [ 'secondary-nav-aligned-left', 'secondary-nav-aligned-center', 'secondary-nav-aligned-right' ];
|
||||
$.each( classes, function( i, v ) {
|
||||
$( 'body' ).removeClass( v );
|
||||
});
|
||||
$( 'body' ).addClass( 'secondary-nav-aligned-' + newval );
|
||||
} );
|
||||
} );
|
||||
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_menu_item]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
jQuery( 'head' ).append( '<style id="secondary_menu_item">.secondary-navigation .main-nav ul li a, .secondary-navigation .menu-toggle{padding: 0 ' + newval + 'px;}.secondary-navigation .menu-item-has-children .dropdown-menu-toggle{padding-right:' + newval + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#secondary_menu_item' ).not( ':last' ).remove();
|
||||
}, 50);
|
||||
} );
|
||||
} );
|
||||
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_menu_item_height]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
jQuery( 'head' ).append( '<style id="secondary_menu_item_height">.secondary-navigation .main-nav ul li a, .secondary-navigation .menu-toggle, .secondary-navigation .top-bar{line-height: ' + newval + 'px;}.secondary-navigation ul ul{top:' + newval + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#secondary_menu_item_height' ).not( ':last' ).remove();
|
||||
}, 50);
|
||||
} );
|
||||
} );
|
||||
|
||||
wp.customize( 'generate_secondary_nav_settings[secondary_sub_menu_item_height]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
jQuery( 'head' ).append( '<style id="secondary_sub_menu_item_height">.secondary-navigation .main-nav ul ul li a{padding-top: ' + newval + 'px;padding-bottom: ' + newval + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#secondary_sub_menu_item_height' ).not( ':last' ).remove();
|
||||
}, 50);
|
||||
} );
|
||||
} );
|
||||
|
||||
})( jQuery );
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
Addon Name: Generate Secondary Nav
|
||||
Author: Thomas Usborne
|
||||
Author URI: http://edge22.com
|
||||
*/
|
||||
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define the version
|
||||
if ( ! defined( 'GENERATE_SECONDARY_NAV_VERSION' ) ) {
|
||||
define( 'GENERATE_SECONDARY_NAV_VERSION', GP_PREMIUM_VERSION );
|
||||
}
|
||||
|
||||
// Include functions identical between standalone addon and GP Premium
|
||||
require plugin_dir_path( __FILE__ ) . 'functions/functions.php';
|
Reference in New Issue
Block a user