updated plugin GP Premium version 1.11.2

This commit is contained in:
2020-08-13 14:53:39 +00:00
committed by Gitium
parent 3f0f8d3ac9
commit 885bbdd113
151 changed files with 11329 additions and 6954 deletions

View File

@ -1,35 +1,40 @@
<?php
// No direct access, please
/**
* This file handles the content spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
// Add our old Spacing section
// Add our old Spacing section.
$wp_customize->add_section(
'generate_spacing_content',
array(
'title' => __( 'Content', 'gp-premium' ),
'capability' => 'edit_theme_options',
'priority' => 10,
'panel' => 'generate_spacing_panel'
'panel' => 'generate_spacing_panel',
)
);
// If we don't have a layout panel, use our old spacing section
// If we don't have a layout panel, use our old spacing section.
if ( $wp_customize->get_panel( 'generate_layout_panel' ) ) {
$content_section = 'generate_layout_container';
} else {
$content_section = 'generate_spacing_content';
}
// Take control of the container width control
// This control is handled by the free theme, but we take control of it here for consistency between control styles
// Take control of the container width control.
// This control is handled by the free theme, but we take control of it here for consistency between control styles.
$wp_customize->add_control(
new GeneratePress_Pro_Range_Slider_Control(
$wp_customize,
'generate_settings[container_width]',
array(
'label' => __( 'Container Width', 'generatepress' ),
'label' => __( 'Container Width', 'gp-premium' ),
'section' => 'generate_layout_container',
'settings' => array(
'desktop' => 'generate_settings[container_width]',
@ -48,14 +53,15 @@ $wp_customize->add_control(
)
);
// Separating space
// Separating space.
$wp_customize->add_setting(
'generate_spacing_settings[separator]', array(
'generate_spacing_settings[separator]',
array(
'default' => $defaults['separator'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -82,43 +88,47 @@ $wp_customize->add_control(
)
);
// Content padding top
$wp_customize->add_setting( 'generate_spacing_settings[content_top]',
// Content padding top.
$wp_customize->add_setting(
'generate_spacing_settings[content_top]',
array(
'default' => $defaults['content_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Content padding right
$wp_customize->add_setting( 'generate_spacing_settings[content_right]',
// Content padding right.
$wp_customize->add_setting(
'generate_spacing_settings[content_right]',
array(
'default' => $defaults['content_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Content padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[content_bottom]',
// Content padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[content_bottom]',
array(
'default' => $defaults['content_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Content padding left
$wp_customize->add_setting( 'generate_spacing_settings[content_left]',
// Content padding left.
$wp_customize->add_setting(
'generate_spacing_settings[content_left]',
array(
'default' => $defaults['content_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -129,78 +139,83 @@ $content_padding_settings = array(
'desktop_left' => 'generate_spacing_settings[content_left]',
);
// If mobile_content_top is set, the rest of them are too
// We have to check as these defaults are set in the theme
if ( isset( $defaults[ 'mobile_content_top' ] ) ) {
// If mobile_content_top is set, the rest of them are too.
// We have to check as these defaults are set in the theme.
if ( isset( $defaults['mobile_content_top'] ) ) {
$content_padding_settings['mobile_top'] = 'generate_spacing_settings[mobile_content_top]';
$content_padding_settings['mobile_right'] = 'generate_spacing_settings[mobile_content_right]';
$content_padding_settings['mobile_bottom'] = 'generate_spacing_settings[mobile_content_bottom]';
$content_padding_settings['mobile_left'] = 'generate_spacing_settings[mobile_content_left]';
$content_padding_settings['mobile_right'] = 'generate_spacing_settings[mobile_content_right]';
$content_padding_settings['mobile_bottom'] = 'generate_spacing_settings[mobile_content_bottom]';
$content_padding_settings['mobile_left'] = 'generate_spacing_settings[mobile_content_left]';
// Mobile content padding top
$wp_customize->add_setting( 'generate_spacing_settings[mobile_content_top]',
// Mobile content padding top.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_content_top]',
array(
'default' => $defaults['mobile_content_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Content padding right
$wp_customize->add_setting( 'generate_spacing_settings[mobile_content_right]',
// Content padding right.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_content_right]',
array(
'default' => $defaults['mobile_content_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Content padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[mobile_content_bottom]',
// Content padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_content_bottom]',
array(
'default' => $defaults['mobile_content_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Content padding left
$wp_customize->add_setting( 'generate_spacing_settings[mobile_content_left]',
// Content padding left.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_content_left]',
array(
'default' => $defaults['mobile_content_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
}
// Make use of the content padding settings
// Make use of the content padding settings.
$wp_customize->add_control(
new GeneratePress_Spacing_Control(
$wp_customize,
'content_spacing',
array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Content Padding', 'gp-premium' ),
'section' => $content_section,
'settings' => $content_padding_settings,
'element' => 'content',
'priority' => 99
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Content Padding', 'gp-premium' ),
'section' => $content_section,
'settings' => $content_padding_settings,
'element' => 'content',
'priority' => 99,
)
)
);
$wp_customize->add_setting(
'generate_spacing_settings[content_element_separator]', array(
'generate_spacing_settings[content_element_separator]',
array(
'default' => $defaults['content_element_separator'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'generate_premium_sanitize_decimal_integer',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);

View File

@ -1,190 +1,207 @@
<?php
// No direct access, please
/**
* This file handles the footer spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
// Add our section
// This isn't used anymore if the Layout panel exists
// Add our section.
// This isn't used anymore if the Layout panel exists.
$wp_customize->add_section(
'generate_spacing_footer',
array(
'title' => __( 'Footer', 'gp-premium' ),
'capability' => 'edit_theme_options',
'priority' => 20,
'panel' => 'generate_spacing_panel'
'panel' => 'generate_spacing_panel',
)
);
// Use our layout panel if it exists
// Use our layout panel if it exists.
if ( $wp_customize->get_panel( 'generate_layout_panel' ) ) {
$footer_section = 'generate_layout_footer';
} else {
$footer_section = 'generate_spacing_footer';
}
// Footer widget area padding top
$wp_customize->add_setting( 'generate_spacing_settings[footer_widget_container_top]',
// Footer widget area padding top.
$wp_customize->add_setting(
'generate_spacing_settings[footer_widget_container_top]',
array(
'default' => $defaults['footer_widget_container_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding right
$wp_customize->add_setting( 'generate_spacing_settings[footer_widget_container_right]',
// Footer widget area padding right.
$wp_customize->add_setting(
'generate_spacing_settings[footer_widget_container_right]',
array(
'default' => $defaults['footer_widget_container_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[footer_widget_container_bottom]',
// Footer widget area padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[footer_widget_container_bottom]',
array(
'default' => $defaults['footer_widget_container_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding left
$wp_customize->add_setting( 'generate_spacing_settings[footer_widget_container_left]',
// Footer widget area padding left.
$wp_customize->add_setting(
'generate_spacing_settings[footer_widget_container_left]',
array(
'default' => $defaults['footer_widget_container_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding top
$wp_customize->add_setting( 'generate_spacing_settings[mobile_footer_widget_container_top]',
// Footer widget area padding top.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_footer_widget_container_top]',
array(
'default' => $defaults['mobile_footer_widget_container_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding right
$wp_customize->add_setting( 'generate_spacing_settings[mobile_footer_widget_container_right]',
// Footer widget area padding right.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_footer_widget_container_right]',
array(
'default' => $defaults['mobile_footer_widget_container_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[mobile_footer_widget_container_bottom]',
// Footer widget area padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_footer_widget_container_bottom]',
array(
'default' => $defaults['mobile_footer_widget_container_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer widget area padding left
$wp_customize->add_setting( 'generate_spacing_settings[mobile_footer_widget_container_left]',
// Footer widget area padding left.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_footer_widget_container_left]',
array(
'default' => $defaults['mobile_footer_widget_container_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Make use of the Footer widget area padding settings
// Make use of the Footer widget area padding settings.
$wp_customize->add_control(
new GeneratePress_Spacing_Control(
$wp_customize,
'footer_widget_area_spacing',
array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Footer Widget Area Padding', 'gp-premium' ),
'section' => $footer_section,
'settings' => array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Footer Widget Area Padding', 'gp-premium' ),
'section' => $footer_section,
'settings' => array(
'desktop_top' => 'generate_spacing_settings[footer_widget_container_top]',
'desktop_right' => 'generate_spacing_settings[footer_widget_container_right]',
'desktop_bottom' => 'generate_spacing_settings[footer_widget_container_bottom]',
'desktop_left' => 'generate_spacing_settings[footer_widget_container_left]',
'mobile_top' => 'generate_spacing_settings[mobile_footer_widget_container_top]',
'mobile_right' => 'generate_spacing_settings[mobile_footer_widget_container_right]',
'mobile_bottom' => 'generate_spacing_settings[mobile_footer_widget_container_bottom]',
'mobile_left' => 'generate_spacing_settings[mobile_footer_widget_container_left]'
'mobile_top' => 'generate_spacing_settings[mobile_footer_widget_container_top]',
'mobile_right' => 'generate_spacing_settings[mobile_footer_widget_container_right]',
'mobile_bottom' => 'generate_spacing_settings[mobile_footer_widget_container_bottom]',
'mobile_left' => 'generate_spacing_settings[mobile_footer_widget_container_left]',
),
'element' => 'footer_widget_area',
'priority' => 99
'element' => 'footer_widget_area',
'priority' => 99,
)
)
);
// Footer padding top
$wp_customize->add_setting( 'generate_spacing_settings[footer_top]',
// Footer padding top.
$wp_customize->add_setting(
'generate_spacing_settings[footer_top]',
array(
'default' => $defaults['footer_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer padding right
$wp_customize->add_setting( 'generate_spacing_settings[footer_right]',
// Footer padding right.
$wp_customize->add_setting(
'generate_spacing_settings[footer_right]',
array(
'default' => $defaults['footer_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[footer_bottom]',
// Footer padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[footer_bottom]',
array(
'default' => $defaults['footer_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Footer padding left
$wp_customize->add_setting( 'generate_spacing_settings[footer_left]',
// Footer padding left.
$wp_customize->add_setting(
'generate_spacing_settings[footer_left]',
array(
'default' => $defaults['footer_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Make use of the footer padding settings
// Make use of the footer padding settings.
$wp_customize->add_control(
new GeneratePress_Spacing_Control(
$wp_customize,
'footer_spacing',
array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Footer Padding', 'gp-premium' ),
'section' => $footer_section,
'settings' => array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Footer Padding', 'gp-premium' ),
'section' => $footer_section,
'settings' => array(
'desktop_top' => 'generate_spacing_settings[footer_top]',
'desktop_right' => 'generate_spacing_settings[footer_right]',
'desktop_bottom' => 'generate_spacing_settings[footer_bottom]',
'desktop_left' => 'generate_spacing_settings[footer_left]'
'desktop_left' => 'generate_spacing_settings[footer_left]',
),
'element' => 'footer',
'priority' => 105
'element' => 'footer',
'priority' => 105,
)
)
);

View File

@ -1,103 +1,116 @@
<?php
// No direct access, please
/**
* This file handles the header spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
// Add our old header section
// Add our old header section.
$wp_customize->add_section(
'generate_spacing_header',
array(
'title' => __( 'Header', 'gp-premium' ),
'capability' => 'edit_theme_options',
'priority' => 5,
'panel' => 'generate_spacing_panel'
'panel' => 'generate_spacing_panel',
)
);
// If we don't have a layout panel, use our old spacing section
// If we don't have a layout panel, use our old spacing section.
$header_section = ( $wp_customize->get_panel( 'generate_layout_panel' ) ) ? 'generate_layout_header' : 'generate_spacing_header';
// Header top
$wp_customize->add_setting( 'generate_spacing_settings[header_top]',
// Header top.
$wp_customize->add_setting(
'generate_spacing_settings[header_top]',
array(
'default' => $defaults['header_top'],
'type' => 'option',
'default' => $defaults['header_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Header right
$wp_customize->add_setting( 'generate_spacing_settings[header_right]',
// Header right.
$wp_customize->add_setting(
'generate_spacing_settings[header_right]',
array(
'default' => $defaults['header_right'],
'type' => 'option',
'default' => $defaults['header_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Header bottom
$wp_customize->add_setting( 'generate_spacing_settings[header_bottom]',
// Header bottom.
$wp_customize->add_setting(
'generate_spacing_settings[header_bottom]',
array(
'default' => $defaults['header_bottom'],
'type' => 'option',
'default' => $defaults['header_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Header left
$wp_customize->add_setting( 'generate_spacing_settings[header_left]',
// Header left.
$wp_customize->add_setting(
'generate_spacing_settings[header_left]',
array(
'default' => $defaults['header_left'],
'type' => 'option',
'default' => $defaults['header_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
$wp_customize->add_setting( 'generate_spacing_settings[mobile_header_top]',
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_top]',
array(
'default' => $defaults['mobile_header_top'],
'type' => 'option',
'default' => $defaults['mobile_header_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Header right
$wp_customize->add_setting( 'generate_spacing_settings[mobile_header_right]',
// Header right.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_right]',
array(
'default' => $defaults['mobile_header_right'],
'type' => 'option',
'default' => $defaults['mobile_header_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Header bottom
$wp_customize->add_setting( 'generate_spacing_settings[mobile_header_bottom]',
// Header bottom.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_bottom]',
array(
'default' => $defaults['mobile_header_bottom'],
'type' => 'option',
'default' => $defaults['mobile_header_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Header left
$wp_customize->add_setting( 'generate_spacing_settings[mobile_header_left]',
// Header left.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_left]',
array(
'default' => $defaults['mobile_header_left'],
'type' => 'option',
'default' => $defaults['mobile_header_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Do something with our header controls
// Do something with our header controls.
$wp_customize->add_control(
new GeneratePress_Spacing_Control(
$wp_customize,
@ -107,16 +120,16 @@ $wp_customize->add_control(
'label' => esc_html__( 'Header Padding', 'gp-premium' ),
'section' => $header_section,
'settings' => array(
'desktop_top' => 'generate_spacing_settings[header_top]',
'desktop_right' => 'generate_spacing_settings[header_right]',
'desktop_bottom' => 'generate_spacing_settings[header_bottom]',
'desktop_left' => 'generate_spacing_settings[header_left]',
'desktop_top' => 'generate_spacing_settings[header_top]',
'desktop_right' => 'generate_spacing_settings[header_right]',
'desktop_bottom' => 'generate_spacing_settings[header_bottom]',
'desktop_left' => 'generate_spacing_settings[header_left]',
'mobile_top' => 'generate_spacing_settings[mobile_header_top]',
'mobile_right' => 'generate_spacing_settings[mobile_header_right]',
'mobile_bottom' => 'generate_spacing_settings[mobile_header_bottom]',
'mobile_left' => 'generate_spacing_settings[mobile_header_left]'
'mobile_left' => 'generate_spacing_settings[mobile_header_left]',
),
'element' => 'header',
'element' => 'header',
)
)
);

View File

@ -144,8 +144,9 @@ generate_spacing_live_update( 'mobile_featured_image_padding_left', 'mobile_cont
* Main navigation spacing
*/
var menu_items = '.main-navigation .main-nav ul li a,\
.menu-toggle,\
.main-navigation .mobile-bar-items a';
.main-navigation .menu-toggle,\
.main-navigation .mobile-bar-items a,\
.main-navigation .menu-bar-item > a';
// Menu item width
generate_spacing_live_update( 'menu_item_padding_left', 'menu_item', menu_items + ', .slideout-navigation button.slideout-exit', 'padding-left', false, false, gp_spacing.desktop );
@ -156,8 +157,8 @@ generate_spacing_live_update( 'menu_item_padding_right', 'menu_item', menu_items
//generate_spacing_live_update( 'tablet_menu_item_padding_right', 'tablet_menu_item', menu_items, 'padding-right', false, false, gp_spacing.tablet );
// Mobile menu item width
generate_spacing_live_update( 'mobile_menu_item_padding_left', 'mobile_menu_item', '.menu-toggle,.main-navigation .mobile-bar-items a', 'padding-left', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_menu_item_padding_right', 'mobile_menu_item', '.menu-toggle,.main-navigation .mobile-bar-items a', 'padding-right', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_menu_item_padding_left', 'mobile_menu_item', '.main-navigation .menu-toggle,.main-navigation .mobile-bar-items a, .main-navigation .menu-bar-item > a', 'padding-left', false, false, gp_spacing.mobile );
generate_spacing_live_update( 'mobile_menu_item_padding_right', 'mobile_menu_item', '.main-navigation .menu-toggle,.main-navigation .mobile-bar-items a, .main-navigation .menu-bar-item > a', 'padding-right', false, false, gp_spacing.mobile );
// Menu item height
generate_spacing_live_update( 'menu_item_height', 'menu_item_height', menu_items, 'line-height', false, false, gp_spacing.desktop );
@ -389,61 +390,68 @@ wp.customize( 'generate_spacing_settings[right_sidebar_width]', function( value
var body = jQuery( 'body' );
if ( jQuery( '#right-sidebar' ).length ) {
if ( gp_spacing.isFlex ) {
var rightSidebar = jQuery( '#right-sidebar' );
// Left sidebar width
var left_sidebar = ( jQuery( '#left-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[left_sidebar_width]')() : 0;
if ( rightSidebar.length ) {
rightSidebar.css( 'width', newval + '%' );
}
} else {
// Left sidebar width
var left_sidebar = ( jQuery( '#left-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[left_sidebar_width]')() : 0;
// Right sidebar class
jQuery( "#right-sidebar" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + newval ).addClass( 'tablet-grid-' + newval ).addClass( 'grid-parent' );
// Right sidebar class
jQuery( "#right-sidebar" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + newval ).addClass( 'tablet-grid-' + newval ).addClass( 'grid-parent' );
// Content area class
jQuery( ".content-area" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + ( 100 - newval - left_sidebar ) ).addClass( 'tablet-grid-' + ( 100 - newval - left_sidebar ) ).addClass( 'grid-parent' );
// Content area class
jQuery( ".content-area" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + ( 100 - newval - left_sidebar ) ).addClass( 'tablet-grid-' + ( 100 - newval - left_sidebar ) ).addClass( 'grid-parent' );
if ( body.hasClass( 'both-sidebars' ) ) {
var content_width = ( 100 - newval - left_sidebar );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( content_width ) ).addClass( 'tablet-pull-' + ( content_width ) );
}
if ( body.hasClass( 'both-sidebars' ) ) {
var content_width = ( 100 - newval - left_sidebar );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( content_width ) ).addClass( 'tablet-pull-' + ( content_width ) );
}
if ( body.hasClass( 'both-left' ) ) {
var total_sidebar_width = ( parseInt( left_sidebar ) + parseInt( newval ) );
if ( body.hasClass( 'both-left' ) ) {
var total_sidebar_width = ( parseInt( left_sidebar ) + parseInt( newval ) );
jQuery( '#right-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '#right-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + ( total_sidebar_width ) ).addClass( 'tablet-push-' + ( total_sidebar_width ) );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + ( total_sidebar_width ) ).addClass( 'tablet-push-' + ( total_sidebar_width ) );
}
}
jQuery('body').trigger('generate_spacing_updated');
}
@ -457,93 +465,101 @@ wp.customize( 'generate_spacing_settings[left_sidebar_width]', function( value )
value.bind( function( newval ) {
var body = jQuery( 'body' );
if ( jQuery( '#left-sidebar' ).length ) {
// Right sidebar width
var right_sidebar = ( jQuery( '#right-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0;
if ( gp_spacing.isFlex ) {
var leftSidebar = jQuery( '#left-sidebar' );
// Right sidebar class
jQuery( "#left-sidebar" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + newval ).addClass( 'tablet-grid-' + newval ).addClass( 'grid-parent' );
if ( leftSidebar.length ) {
leftSidebar.css( 'width', newval + '%' );
}
} else {
// Right sidebar width
var right_sidebar = ( jQuery( '#right-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0;
// Content area class
jQuery( ".content-area" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + ( 100 - newval - right_sidebar ) ).addClass( 'tablet-grid-' + ( 100 - newval - right_sidebar ) ).addClass( 'grid-parent' );
// Right sidebar class
jQuery( "#left-sidebar" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + newval ).addClass( 'tablet-grid-' + newval ).addClass( 'grid-parent' );
if ( body.hasClass( 'left-sidebar' ) ) {
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
// Content area class
jQuery( ".content-area" ).removeClass(function (index, css) {
return (css.match (/(^|\s)grid-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - newval ) ).addClass( 'tablet-pull-' + ( 100 - newval ) );
return (css.match (/(^|\s)tablet-grid-\S+/g) || []).join(' ');
}).addClass( 'grid-' + ( 100 - newval - right_sidebar ) ).addClass( 'tablet-grid-' + ( 100 - newval - right_sidebar ) ).addClass( 'grid-parent' );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + newval ).addClass( 'tablet-push-' + newval ).addClass( 'grid-' + ( 100 - newval ) ).addClass( 'tablet-grid-' + ( 100 - newval ) );
}
if ( body.hasClass( 'left-sidebar' ) ) {
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - newval ) ).addClass( 'tablet-pull-' + ( 100 - newval ) );
if ( body.hasClass( 'both-sidebars' ) ) {
var content_width = ( 100 - newval - right_sidebar );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( content_width ) ).addClass( 'tablet-pull-' + ( content_width ) );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + newval ).addClass( 'tablet-push-' + newval ).addClass( 'grid-' + ( 100 - newval ) ).addClass( 'tablet-grid-' + ( 100 - newval ) );
}
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + ( newval ) ).addClass( 'tablet-push-' + ( newval ) );
}
if ( body.hasClass( 'both-sidebars' ) ) {
var content_width = ( 100 - newval - right_sidebar );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( content_width ) ).addClass( 'tablet-pull-' + ( content_width ) );
if ( body.hasClass( 'both-left' ) ) {
var content_width = ( 100 - newval - right_sidebar );
var total_sidebar_width = ( parseInt( right_sidebar ) + parseInt( newval ) );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + ( newval ) ).addClass( 'tablet-push-' + ( newval ) );
}
jQuery( '#right-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
if ( body.hasClass( 'both-left' ) ) {
var content_width = ( 100 - newval - right_sidebar );
var total_sidebar_width = ( parseInt( right_sidebar ) + parseInt( newval ) );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '#right-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + ( total_sidebar_width ) ).addClass( 'tablet-push-' + ( total_sidebar_width ) );
jQuery( '#left-sidebar' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).addClass( 'pull-' + ( 100 - total_sidebar_width ) ).addClass( 'tablet-pull-' + ( 100 - total_sidebar_width ) );
jQuery( '.content-area' ).removeClass(function (index, css) {
return (css.match (/(^|\s)pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-pull-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)push-\S+/g) || []).join(' ');
}).removeClass(function (index, css) {
return (css.match (/(^|\s)tablet-push-\S+/g) || []).join(' ');
}).addClass( 'push-' + ( total_sidebar_width ) ).addClass( 'tablet-push-' + ( total_sidebar_width ) );
}
}
jQuery('body').trigger('generate_spacing_updated');
}

View File

@ -1,41 +1,48 @@
<?php
// No direct access, please
/**
* This file handles the navigation spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
// Add our old navigation section
// Add our old navigation section.
$wp_customize->add_section(
'generate_spacing_navigation',
array(
'title' => __( 'Primary Navigation', 'gp-premium' ),
'capability' => 'edit_theme_options',
'priority' => 15,
'panel' => 'generate_spacing_panel'
'panel' => 'generate_spacing_panel',
)
);
// If our new Layout section doesn't exist, use the old navigation section
// If our new Layout section doesn't exist, use the old navigation section.
$navigation_section = ( $wp_customize->get_panel( 'generate_layout_panel' ) ) ? 'generate_layout_navigation' : 'generate_spacing_navigation';
// Menu item width
// Menu item width.
$wp_customize->add_setting(
'generate_spacing_settings[menu_item]', array(
'generate_spacing_settings[menu_item]',
array(
'default' => $defaults['menu_item'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
$wp_customize->add_setting(
'generate_spacing_settings[mobile_menu_item]', array(
'generate_spacing_settings[mobile_menu_item]',
array(
'default' => $defaults['mobile_menu_item'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -71,24 +78,26 @@ $wp_customize->add_control(
)
);
// Menu item height
// Menu item height.
$wp_customize->add_setting(
'generate_spacing_settings[menu_item_height]', array(
'generate_spacing_settings[menu_item_height]',
array(
'default' => $defaults['menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
$wp_customize->add_setting(
'generate_spacing_settings[mobile_menu_item_height]', array(
'generate_spacing_settings[mobile_menu_item_height]',
array(
'default' => $defaults['mobile_menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -124,14 +133,15 @@ $wp_customize->add_control(
)
);
// Sub-menu item height
// Sub-menu item height.
$wp_customize->add_setting(
'generate_spacing_settings[sub_menu_item_height]', array(
'generate_spacing_settings[sub_menu_item_height]',
array(
'default' => $defaults['sub_menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -160,14 +170,14 @@ $wp_customize->add_control(
);
if ( isset( $defaults['sub_menu_width'] ) ) {
// Sub-menu item height
$wp_customize->add_setting(
'generate_spacing_settings[sub_menu_width]', array(
'generate_spacing_settings[sub_menu_width]',
array(
'default' => $defaults['sub_menu_width'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -196,14 +206,15 @@ if ( isset( $defaults['sub_menu_width'] ) ) {
);
}
// Sticky menu height
// Sticky menu height.
$wp_customize->add_setting(
'generate_spacing_settings[sticky_menu_item_height]', array(
'generate_spacing_settings[sticky_menu_item_height]',
array(
'default' => $defaults['sticky_menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -232,14 +243,15 @@ $wp_customize->add_control(
)
);
// Off canvas menu height
// Off canvas menu height.
$wp_customize->add_setting(
'generate_spacing_settings[off_canvas_menu_item_height]', array(
'generate_spacing_settings[off_canvas_menu_item_height]',
array(
'default' => $defaults['off_canvas_menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'generate_premium_sanitize_empty_absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);

View File

@ -1,7 +1,12 @@
<?php
// No direct access, please
/**
* This file handles the secondary navigation spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
if ( ! function_exists( 'generate_spacing_secondary_nav_customizer' ) ) {
@ -16,37 +21,42 @@ if ( ! function_exists( 'generate_spacing_secondary_nav_customizer' ) ) {
* as we check to see if the layout control exists.
*
* Secondary Nav now uses 100 as a priority.
*
* @param object $wp_customize The Customizer object.
*/
function generate_spacing_secondary_nav_customizer( $wp_customize ) {
// Bail if we don't have our defaults
// Bail if we don't have our defaults.
if ( ! function_exists( 'generate_secondary_nav_get_defaults' ) ) {
return;
}
// Make sure Secondary Nav is activated
// Make sure Secondary Nav is activated.
if ( ! $wp_customize->get_section( 'secondary_nav_section' ) ) {
return;
}
// Get our controls
// Get our controls.
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
// Get our defaults
// Get our defaults.
$defaults = generate_secondary_nav_get_defaults();
// Remove our old label control if it exists
// It only would if the user is using an old Secondary Nav add-on version
if ( $wp_customize->get_control( 'generate_secondary_navigation_spacing_title' ) ) $wp_customize->remove_control( 'generate_secondary_navigation_spacing_title' );
// Remove our old label control if it exists.
// It only would if the user is using an old Secondary Nav add-on version.
if ( $wp_customize->get_control( 'generate_secondary_navigation_spacing_title' ) ) {
$wp_customize->remove_control( 'generate_secondary_navigation_spacing_title' );
}
// Menu item width
// Menu item width.
$wp_customize->add_setting(
'generate_secondary_nav_settings[secondary_menu_item]', array(
'generate_secondary_nav_settings[secondary_menu_item]',
array(
'default' => $defaults['secondary_menu_item'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -74,14 +84,15 @@ if ( ! function_exists( 'generate_spacing_secondary_nav_customizer' ) ) {
)
);
// Menu item height
// Menu item height.
$wp_customize->add_setting(
'generate_secondary_nav_settings[secondary_menu_item_height]', array(
'generate_secondary_nav_settings[secondary_menu_item_height]',
array(
'default' => $defaults['secondary_menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -109,14 +120,15 @@ if ( ! function_exists( 'generate_spacing_secondary_nav_customizer' ) ) {
)
);
// Sub-menu height
// Sub-menu height.
$wp_customize->add_setting(
'generate_secondary_nav_settings[secondary_sub_menu_item_height]', array(
'generate_secondary_nav_settings[secondary_sub_menu_item_height]',
array(
'default' => $defaults['secondary_sub_menu_item_height'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);

View File

@ -1,115 +1,128 @@
<?php
// No direct access, please
/**
* This file handles the sidebar spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
// Add our old Sidebars section
// This section is no longer used but is kept around for back compat
// Add our old Sidebars section.
// This section is no longer used but is kept around for back compat.
$wp_customize->add_section(
'generate_spacing_sidebar',
array(
'title' => __( 'Sidebars', 'gp-premium' ),
'capability' => 'edit_theme_options',
'priority' => 15,
'panel' => 'generate_spacing_panel'
'panel' => 'generate_spacing_panel',
)
);
// Add our controls to the Layout panel if it exists
// If not, use the old section
// Add our controls to the Layout panel if it exists.
// If not, use the old section.
$widget_section = ( $wp_customize->get_panel( 'generate_layout_panel' ) ) ? 'generate_layout_sidebars' : 'generate_spacing_sidebar';
// Widget padding top
$wp_customize->add_setting( 'generate_spacing_settings[widget_top]',
// Widget padding top.
$wp_customize->add_setting(
'generate_spacing_settings[widget_top]',
array(
'default' => $defaults['widget_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding right
$wp_customize->add_setting( 'generate_spacing_settings[widget_right]',
// Widget padding right.
$wp_customize->add_setting(
'generate_spacing_settings[widget_right]',
array(
'default' => $defaults['widget_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[widget_bottom]',
// Widget padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[widget_bottom]',
array(
'default' => $defaults['widget_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding left
$wp_customize->add_setting( 'generate_spacing_settings[widget_left]',
// Widget padding left.
$wp_customize->add_setting(
'generate_spacing_settings[widget_left]',
array(
'default' => $defaults['widget_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding top
$wp_customize->add_setting( 'generate_spacing_settings[mobile_widget_top]',
// Widget padding top.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_widget_top]',
array(
'default' => $defaults['mobile_widget_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding right
$wp_customize->add_setting( 'generate_spacing_settings[mobile_widget_right]',
// Widget padding right.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_widget_right]',
array(
'default' => $defaults['mobile_widget_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[mobile_widget_bottom]',
// Widget padding bottom.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_widget_bottom]',
array(
'default' => $defaults['mobile_widget_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding left
$wp_customize->add_setting( 'generate_spacing_settings[mobile_widget_left]',
// Widget padding left.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_widget_left]',
array(
'default' => $defaults['mobile_widget_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Make use of the widget padding settings
// Make use of the widget padding settings.
$wp_customize->add_control(
new GeneratePress_Spacing_Control(
$wp_customize,
'widget_spacing',
array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Widget Padding', 'gp-premium' ),
'section' => $widget_section,
'settings' => array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Widget Padding', 'gp-premium' ),
'section' => $widget_section,
'settings' => array(
'desktop_top' => 'generate_spacing_settings[widget_top]',
'desktop_right' => 'generate_spacing_settings[widget_right]',
'desktop_bottom' => 'generate_spacing_settings[widget_bottom]',
@ -117,22 +130,23 @@ $wp_customize->add_control(
'mobile_top' => 'generate_spacing_settings[mobile_widget_top]',
'mobile_right' => 'generate_spacing_settings[mobile_widget_right]',
'mobile_bottom' => 'generate_spacing_settings[mobile_widget_bottom]',
'mobile_left' => 'generate_spacing_settings[mobile_widget_left]'
'mobile_left' => 'generate_spacing_settings[mobile_widget_left]',
),
'element' => 'widget',
'priority' => 99
'element' => 'widget',
'priority' => 99,
)
)
);
// Left sidebar width
// Left sidebar width.
$wp_customize->add_setting(
'generate_spacing_settings[left_sidebar_width]', array(
'generate_spacing_settings[left_sidebar_width]',
array(
'default' => $defaults['left_sidebar_width'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
@ -160,14 +174,15 @@ $wp_customize->add_control(
)
);
// Right sidebar width
// Right sidebar width.
$wp_customize->add_setting(
'generate_spacing_settings[right_sidebar_width]', array(
'generate_spacing_settings[right_sidebar_width]',
array(
'default' => $defaults['right_sidebar_width'],
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);

View File

@ -1,67 +1,71 @@
<?php
// No direct access, please
/**
* This file handles the top bar spacing Customizer options.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
exit; // No direct access, please.
}
if ( isset( $defaults[ 'top_bar_top' ] ) ) {
// Widget padding top
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_top]',
if ( isset( $defaults['top_bar_top'] ) ) {
$wp_customize->add_setting(
'generate_spacing_settings[top_bar_top]',
array(
'default' => $defaults['top_bar_top'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding right
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_right]',
$wp_customize->add_setting(
'generate_spacing_settings[top_bar_right]',
array(
'default' => $defaults['top_bar_right'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding bottom
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_bottom]',
$wp_customize->add_setting(
'generate_spacing_settings[top_bar_bottom]',
array(
'default' => $defaults['top_bar_bottom'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Widget padding left
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_left]',
$wp_customize->add_setting(
'generate_spacing_settings[top_bar_left]',
array(
'default' => $defaults['top_bar_left'],
'type' => 'option',
'sanitize_callback' => 'absint',
'transport' => 'postMessage'
'transport' => 'postMessage',
)
);
// Make use of the widget padding settings
$wp_customize->add_control(
new GeneratePress_Spacing_Control(
$wp_customize,
'top_bar_spacing',
array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Top Bar Padding', 'gp-premium' ),
'section' => 'generate_top_bar',
'settings' => array(
'type' => 'generatepress-spacing',
'label' => esc_html__( 'Top Bar Padding', 'gp-premium' ),
'section' => 'generate_top_bar',
'settings' => array(
'desktop_top' => 'generate_spacing_settings[top_bar_top]',
'desktop_right' => 'generate_spacing_settings[top_bar_right]',
'desktop_bottom' => 'generate_spacing_settings[top_bar_bottom]',
'desktop_left' => 'generate_spacing_settings[top_bar_left]'
'desktop_left' => 'generate_spacing_settings[top_bar_left]',
),
'element' => 'top_bar',
'priority' => 99,
'element' => 'top_bar',
'priority' => 99,
'active_callback' => 'generate_premium_is_top_bar_active',
)
)