modified file smtp-mailer
This commit is contained in:
@ -0,0 +1,244 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the content spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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.
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_settings[container_width]',
|
||||
array(
|
||||
'label' => __( 'Container Width', 'gp-premium' ),
|
||||
'section' => 'generate_layout_container',
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_settings[container_width]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 700,
|
||||
'max' => 2000,
|
||||
'step' => 5,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 0,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Separating space.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[separator]',
|
||||
array(
|
||||
'default' => $defaults['separator'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[separator]',
|
||||
array(
|
||||
'label' => __( 'Separating Space', 'gp-premium' ),
|
||||
'section' => $content_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[separator]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Content padding top.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[content_top]',
|
||||
array(
|
||||
'default' => $defaults['content_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Content padding right.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[content_right]',
|
||||
array(
|
||||
'default' => $defaults['content_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Content padding bottom.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[content_bottom]',
|
||||
array(
|
||||
'default' => $defaults['content_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Content padding left.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[content_left]',
|
||||
array(
|
||||
'default' => $defaults['content_left'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$content_padding_settings = array(
|
||||
'desktop_top' => 'generate_spacing_settings[content_top]',
|
||||
'desktop_right' => 'generate_spacing_settings[content_right]',
|
||||
'desktop_bottom' => 'generate_spacing_settings[content_bottom]',
|
||||
'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'] ) ) {
|
||||
$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]';
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 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,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[content_element_separator]',
|
||||
array(
|
||||
'label' => __( 'Content Separator', 'gp-premium' ),
|
||||
'sub_description' => __( 'The content separator controls the space between the featured image, title, content and entry meta.', 'gp-premium' ),
|
||||
'section' => $content_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[content_element_separator]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 0,
|
||||
'max' => 10,
|
||||
'step' => .1,
|
||||
'edit' => true,
|
||||
'unit' => 'em',
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
@ -0,0 +1,207 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the footer spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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]',
|
||||
array(
|
||||
'default' => $defaults['footer_widget_container_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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(
|
||||
'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]',
|
||||
),
|
||||
'element' => 'footer_widget_area',
|
||||
'priority' => 99,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Footer padding top.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[footer_top]',
|
||||
array(
|
||||
'default' => $defaults['footer_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer padding right.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[footer_right]',
|
||||
array(
|
||||
'default' => $defaults['footer_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer padding bottom.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[footer_bottom]',
|
||||
array(
|
||||
'default' => $defaults['footer_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Footer padding left.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[footer_left]',
|
||||
array(
|
||||
'default' => $defaults['footer_left'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// 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(
|
||||
'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]',
|
||||
),
|
||||
'element' => 'footer',
|
||||
'priority' => 105,
|
||||
)
|
||||
)
|
||||
);
|
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the header spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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]',
|
||||
array(
|
||||
'default' => $defaults['header_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Header right.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[header_right]',
|
||||
array(
|
||||
'default' => $defaults['header_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Header bottom.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[header_bottom]',
|
||||
array(
|
||||
'default' => $defaults['header_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Header left.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[header_left]',
|
||||
array(
|
||||
'default' => $defaults['header_left'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[mobile_header_top]',
|
||||
array(
|
||||
'default' => $defaults['mobile_header_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Header right.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[mobile_header_right]',
|
||||
array(
|
||||
'default' => $defaults['mobile_header_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Header bottom.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[mobile_header_bottom]',
|
||||
array(
|
||||
'default' => $defaults['mobile_header_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Header left.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[mobile_header_left]',
|
||||
array(
|
||||
'default' => $defaults['mobile_header_left'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Do something with our header controls.
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Spacing_Control(
|
||||
$wp_customize,
|
||||
'header_spacing',
|
||||
array(
|
||||
'type' => 'generatepress-spacing',
|
||||
'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]',
|
||||
'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]',
|
||||
),
|
||||
'element' => 'header',
|
||||
)
|
||||
)
|
||||
);
|
@ -0,0 +1,661 @@
|
||||
function generate_spacing_live_update( name, id, selector, property, negative, divide, media, unit ) {
|
||||
settings = typeof settings !== 'undefined' ? settings : 'generate_spacing_settings';
|
||||
wp.customize( settings + '[' + id + ']', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
negative = typeof negative !== 'undefined' ? negative : false;
|
||||
media = typeof media !== 'undefined' ? media : '';
|
||||
divide = typeof divide !== 'undefined' ? divide : false;
|
||||
unit = typeof unit !== 'undefined' ? unit : 'px';
|
||||
|
||||
// Get new value
|
||||
newval = ( divide ) ? newval / 2 : newval;
|
||||
|
||||
// Check if negative integer
|
||||
negative = ( negative ) ? '-' : '';
|
||||
|
||||
var isTablet = ( 'tablet' == id.substring( 0, 6 ) ) ? true : false,
|
||||
isMobile = ( 'mobile' == id.substring( 0, 6 ) ) ? true : false;
|
||||
|
||||
if ( isTablet ) {
|
||||
if ( '' == wp.customize(settings + '[' + id + ']').get() ) {
|
||||
var desktopID = id.replace( 'tablet_', '' );
|
||||
newval = wp.customize(settings + '[' + desktopID + ']').get();
|
||||
}
|
||||
}
|
||||
|
||||
if ( isMobile ) {
|
||||
if ( '' == wp.customize(settings + '[' + id + ']').get() ) {
|
||||
var desktopID = id.replace( 'mobile_', '' );
|
||||
newval = wp.customize(settings + '[' + desktopID + ']').get();
|
||||
}
|
||||
}
|
||||
|
||||
// We're using a desktop value
|
||||
if ( ! isTablet && ! isMobile ) {
|
||||
|
||||
var tabletValue = ( typeof wp.customize(settings + '[tablet_' + id + ']') !== 'undefined' ) ? wp.customize(settings + '[tablet_' + id + ']').get() : '',
|
||||
mobileValue = ( typeof wp.customize(settings + '[mobile_' + id + ']') !== 'undefined' ) ? wp.customize(settings + '[mobile_' + id + ']').get() : '';
|
||||
|
||||
// The tablet setting exists, mobile doesn't
|
||||
if ( '' !== tabletValue && '' == mobileValue ) {
|
||||
media = gp_spacing.desktop + ', ' + gp_spacing.mobile;
|
||||
}
|
||||
|
||||
// The tablet setting doesn't exist, mobile does
|
||||
if ( '' == tabletValue && '' !== mobileValue ) {
|
||||
media = gp_spacing.desktop + ', ' + gp_spacing.tablet;
|
||||
}
|
||||
|
||||
// The tablet setting doesn't exist, neither does mobile
|
||||
if ( '' == tabletValue && '' == mobileValue ) {
|
||||
media = gp_spacing.desktop + ', ' + gp_spacing.tablet + ', ' + gp_spacing.mobile;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if media query
|
||||
media_query = ( '' !== media ) ? 'media="' + media + '"' : '';
|
||||
|
||||
jQuery( 'head' ).append( '<style id="' + name + '" ' + media_query + '>' + selector + '{' + property + ':' + negative + newval + unit +';}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#' + name ).not( ':last' ).remove();
|
||||
}, 50 );
|
||||
|
||||
jQuery('body').trigger('generate_spacing_updated');
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Top bar padding
|
||||
*/
|
||||
generate_spacing_live_update( 'top_bar_top', 'top_bar_top', '.inside-top-bar', 'padding-top' );
|
||||
generate_spacing_live_update( 'top_bar_right', 'top_bar_right', '.inside-top-bar', 'padding-right' );
|
||||
generate_spacing_live_update( 'top_bar_bottom', 'top_bar_bottom', '.inside-top-bar', 'padding-bottom' );
|
||||
generate_spacing_live_update( 'top_bar_left', 'top_bar_left', '.inside-top-bar', 'padding-left' );
|
||||
|
||||
/**
|
||||
* Header padding
|
||||
*/
|
||||
generate_spacing_live_update( 'header_top', 'header_top', '.inside-header', 'padding-top', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'header_right', 'header_right', '.inside-header', 'padding-right', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'header_bottom', 'header_bottom', '.inside-header', 'padding-bottom', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'header_left', 'header_left', '.inside-header', 'padding-left', false, false, gp_spacing.desktop );
|
||||
|
||||
generate_spacing_live_update( 'mobile_header_top', 'mobile_header_top', '.inside-header', 'padding-top', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_header_right', 'mobile_header_right', '.inside-header', 'padding-right', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_header_bottom', 'mobile_header_bottom', '.inside-header', 'padding-bottom', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_header_left', 'mobile_header_left', '.inside-header', 'padding-left', false, false, gp_spacing.mobile );
|
||||
|
||||
jQuery( window ).on( 'load', function() {
|
||||
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' );
|
||||
|
||||
if ( gp_spacing.isFlex && containerAlignment && 'text' === containerAlignment.get() ) {
|
||||
generate_spacing_live_update( 'header_left_sticky_nav', 'header_left', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-left', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'header_right_sticky_nav', 'header_right', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-right', false, false, gp_spacing.desktop );
|
||||
|
||||
generate_spacing_live_update( 'mobile_header_left_sticky_nav', 'mobile_header_left', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-left', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_header_right_sticky_nav', 'mobile_header_right', '.main-navigation.navigation-stick:not(.has-branding) .inside-navigation.grid-container', 'padding-right', false, false, gp_spacing.mobile );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Content padding
|
||||
*/
|
||||
var content_areas = '.separate-containers .inside-article, \
|
||||
.separate-containers .comments-area, \
|
||||
.separate-containers .page-header, \
|
||||
.separate-containers .paging-navigation, \
|
||||
.one-container .site-content, \
|
||||
.inside-page-header, \
|
||||
.wp-block-group__inner-container';
|
||||
|
||||
generate_spacing_live_update( 'content_top', 'content_top', content_areas, 'padding-top', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'content_right', 'content_right', content_areas, 'padding-right', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'content_bottom', 'content_bottom', content_areas, 'padding-bottom', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'content_left', 'content_left', content_areas, 'padding-left', false, false, gp_spacing.desktop );
|
||||
|
||||
jQuery( window ).on( 'load', function() {
|
||||
var containerAlignment = wp.customize( 'generate_settings[container_alignment]' );
|
||||
|
||||
if ( gp_spacing.isFlex && containerAlignment && 'text' === containerAlignment.get() ) {
|
||||
generate_spacing_live_update( 'content_left_nav_as_header', 'content_left', '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container', 'padding-left', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'content_right_nav_as_header', 'content_right', '.main-navigation.has-branding .inside-navigation.grid-container, .main-navigation.has-branding .inside-navigation.grid-container', 'padding-right', false, false, gp_spacing.desktop );
|
||||
}
|
||||
} );
|
||||
|
||||
generate_spacing_live_update( 'one_container_post_content_bottom', 'content_bottom', '.one-container.archive .post:not(:last-child):not(.is-loop-template-item),.one-container.blog .post:not(:last-child):not(.is-loop-template-item)', 'padding-bottom' );
|
||||
|
||||
/* Mobile content padding */
|
||||
generate_spacing_live_update( 'mobile_content_top', 'mobile_content_top', content_areas, 'padding-top', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_content_right', 'mobile_content_right', content_areas, 'padding-right', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_content_bottom', 'mobile_content_bottom', content_areas, 'padding-bottom', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_content_left', 'mobile_content_left', content_areas, 'padding-left', false, false, gp_spacing.mobile );
|
||||
|
||||
generate_spacing_live_update( 'content-margin-right', 'content_right', '.one-container.right-sidebar .site-main,.one-container.both-right .site-main', 'margin-right' );
|
||||
generate_spacing_live_update( 'content-margin-left', 'content_left', '.one-container.left-sidebar .site-main,.one-container.both-left .site-main', 'margin-left' );
|
||||
generate_spacing_live_update( 'content-margin-right-both', 'content_right', '.one-container.both-sidebars .site-main', 'margin-right' );
|
||||
generate_spacing_live_update( 'content-margin-left-both', 'content_left', '.one-container.both-sidebars .site-main', 'margin-left' );
|
||||
|
||||
/* Content element separator */
|
||||
|
||||
generate_spacing_live_update( 'content_element_separator_top', 'content_element_separator', '.post-image:not(:first-child), .page-content:not(:first-child), .entry-content:not(:first-child), .entry-summary:not(:first-child), footer.entry-meta', 'margin-top', false, false, false, 'em' );
|
||||
generate_spacing_live_update( 'content_element_separator_bottom', 'content_element_separator', '.post-image-above-header .inside-article div.featured-image, .post-image-above-header .inside-article div.post-image', 'margin-bottom', false, false, false, 'em' );
|
||||
|
||||
/**
|
||||
* Featured image padding
|
||||
*/
|
||||
var featured_image_no_padding_x = '.post-image-below-header.post-image-aligned-center .no-featured-image-padding .post-image, \
|
||||
.post-image-below-header.post-image-aligned-center .no-featured-image-padding .featured-image';
|
||||
|
||||
generate_spacing_live_update( 'featured_image_padding_right', 'content_right', featured_image_no_padding_x, 'margin-right', true, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'featured_image_padding_left', 'content_left', featured_image_no_padding_x, 'margin-left', true, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'mobile_featured_image_padding_right', 'mobile_content_right', featured_image_no_padding_x, 'margin-right', true, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_featured_image_padding_left', 'mobile_content_left', featured_image_no_padding_x, 'margin-left', true, false, gp_spacing.mobile );
|
||||
|
||||
var featured_image_no_padding_y = '.post-image-above-header.post-image-aligned-center .no-featured-image-padding .post-image, \
|
||||
.post-image-above-header.post-image-aligned-center .no-featured-image-padding .featured-image';
|
||||
|
||||
generate_spacing_live_update( 'featured_image_padding_top', 'content_top', featured_image_no_padding_y, 'margin-top', true, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'featured_image_padding_right', 'content_right', featured_image_no_padding_y, 'margin-right', true, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'featured_image_padding_left', 'content_left', featured_image_no_padding_y, 'margin-left', true, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'mobile_featured_image_padding_top', 'mobile_content_top', featured_image_no_padding_y, 'margin-top', true, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_featured_image_padding_right', 'mobile_content_right', featured_image_no_padding_y, 'margin-right', true, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_featured_image_padding_left', 'mobile_content_left', featured_image_no_padding_y, 'margin-left', true, false, gp_spacing.mobile );
|
||||
|
||||
/**
|
||||
* Main navigation spacing
|
||||
*/
|
||||
var menu_items = '.main-navigation .main-nav ul li 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 );
|
||||
generate_spacing_live_update( 'menu_item_padding_right', 'menu_item', menu_items + ', .slideout-navigation button.slideout-exit', 'padding-right', false, false, gp_spacing.desktop );
|
||||
|
||||
// Tablet menu item width
|
||||
//generate_spacing_live_update( 'tablet_menu_item_padding_left', 'tablet_menu_item', menu_items, 'padding-left', false, false, gp_spacing.tablet );
|
||||
//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', '.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 );
|
||||
generate_spacing_live_update( 'navigation_logo_height', 'menu_item_height', '.main-navigation .navigation-logo img, .main-navigation .site-logo img', 'height', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'nav_title_height', 'menu_item_height', '.navigation-branding .main-title', 'line-height', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'mobile_header_logo_height', 'menu_item_height', '.mobile-header-navigation .mobile-header-logo img', 'height', false, false, gp_spacing.desktop );
|
||||
|
||||
//generate_spacing_live_update( 'tablet_menu_item_height', 'tablet_menu_item_height', menu_items, 'line-height', false, false, gp_spacing.tablet );
|
||||
//generate_spacing_live_update( 'tablet_navigation_logo_height', 'tablet_menu_item_height', '.main-navigation .navigation-logo img', 'height', false, false, gp_spacing.tablet );
|
||||
//generate_spacing_live_update( 'tablet_mobile_header_logo_height', 'tablet_menu_item_height', '.mobile-header-navigation .mobile-header-logo img', 'height', false, false, gp_spacing.tablet );
|
||||
|
||||
generate_spacing_live_update( 'mobile_menu_item_height', 'mobile_menu_item_height', menu_items, 'line-height', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_navigation_logo_height', 'mobile_menu_item_height', '.main-navigation .site-logo.navigation-logo img, .main-navigation .site-logo img, .main-navigation .navigation-branding img', 'height', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_nav_title_height', 'menu_item_height', '.navigation-branding .main-title', 'line-height', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_mobile_header_logo_height', 'mobile_menu_item_height', '.mobile-header-navigation .site-logo.mobile-header-logo img', 'height', false, false, gp_spacing.mobile );
|
||||
|
||||
// Off canvas menu item height
|
||||
wp.customize( 'generate_spacing_settings[off_canvas_menu_item_height]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
|
||||
if ( '' == newval ) {
|
||||
newval = wp.customize('generate_spacing_settings[menu_item_height]').get();
|
||||
}
|
||||
|
||||
jQuery( 'head' ).append( '<style id="off_canvas_menu_item_height">.slideout-navigation.main-navigation .main-nav > ul > li > a{line-height:' + newval + 'px;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#off_canvas_menu_item_height' ).not( ':last' ).remove();
|
||||
}, 200 );
|
||||
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Main sub-navigation spacing
|
||||
*/
|
||||
generate_spacing_live_update( 'sub_menu_item_height_top', 'sub_menu_item_height', '.main-navigation .main-nav ul ul li a', 'padding-top' );
|
||||
generate_spacing_live_update( 'sub_menu_item_height_right', 'menu_item', '.main-navigation .main-nav ul ul li a', 'padding-right', false, false, gp_spacing.desktop );
|
||||
//generate_spacing_live_update( 'tablet_sub_menu_item_height_right', 'tablet_menu_item', '.main-navigation .main-nav ul ul li a', 'padding-right', false, false, gp_spacing.tablet );
|
||||
generate_spacing_live_update( 'sub_menu_item_height_bottom', 'sub_menu_item_height', '.main-navigation .main-nav ul ul li a', 'padding-bottom' );
|
||||
generate_spacing_live_update( 'sub_menu_item_height_left', 'menu_item', '.main-navigation .main-nav ul ul li a', 'padding-left', false, false, gp_spacing.desktop );
|
||||
//generate_spacing_live_update( 'tablet_sub_menu_item_height_left', 'tablet_menu_item', '.main-navigation .main-nav ul ul li a', 'padding-left', false, false, gp_spacing.tablet );
|
||||
generate_spacing_live_update( 'sub_menu_item_offset', 'menu_item_height', '.main-navigation ul ul', 'top' );
|
||||
|
||||
/**
|
||||
* Main navigation RTL arrow spacing
|
||||
*/
|
||||
generate_spacing_live_update( 'dropdown_menu_arrow', 'menu_item', '.menu-item-has-children .dropdown-menu-toggle', 'padding-right', false, false, gp_spacing.desktop );
|
||||
//generate_spacing_live_update( 'tablet_dropdown_menu_arrow', 'tablet_menu_item', '.menu-item-has-children .dropdown-menu-toggle', 'padding-right', false, false, gp_spacing.tablet );
|
||||
|
||||
/**
|
||||
* Main sub-navigation arrow spacing
|
||||
*/
|
||||
generate_spacing_live_update( 'dropdown_submenu_arrow_top', 'sub_menu_item_height', '.menu-item-has-children ul .dropdown-menu-toggle', 'padding-top' );
|
||||
generate_spacing_live_update( 'dropdown_submenu_arrow_bottom', 'sub_menu_item_height', '.menu-item-has-children ul .dropdown-menu-toggle', 'padding-bottom' );
|
||||
generate_spacing_live_update( 'dropdown_submenu_arrow_margin', 'sub_menu_item_height', '.menu-item-has-children ul .dropdown-menu-toggle', 'margin-top', true );
|
||||
|
||||
/**
|
||||
* Sub-Menu Width
|
||||
*/
|
||||
generate_spacing_live_update( 'sub_menu_width', 'sub_menu_width', '.main-navigation ul ul', 'width' );
|
||||
|
||||
/**
|
||||
- * Sticky menu item height
|
||||
- */
|
||||
wp.customize( 'generate_spacing_settings[sticky_menu_item_height]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
|
||||
if ( '' == newval ) {
|
||||
newval = wp.customize('generate_spacing_settings[menu_item_height]').get();
|
||||
}
|
||||
|
||||
jQuery( 'head' ).append( '<style id="sticky_menu_item_height" media="' + gp_spacing.tablet + ',' + gp_spacing.desktop + '">.main-navigation.sticky-navigation-transition .main-nav > ul > li > a,.sticky-navigation-transition .menu-toggle,.main-navigation.sticky-navigation-transition .mobile-bar-items a, .main-navigation.sticky-navigation-transition .menu-bar-item > a, .main-navigation.sticky-navigation-transition .navigation-branding .main-title{line-height:' + newval + 'px;}</style>' );
|
||||
jQuery( 'head' ).append( '<style id="sticky_menu_item_logo_height" media="' + gp_spacing.tablet + ',' + gp_spacing.desktop + '">.main-navigation.sticky-navigation-transition .navigation-logo.site-logo img, .main-navigation.sticky-navigation-transition .navigation-branding img{height:' + newval + 'px;}</style>' );
|
||||
jQuery( 'head' ).append( '<style id="sticky_menu_item_height_transition">.main-navigation .main-nav ul li a,.menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation .navigation-logo img,.main-navigation .navigation-branding img{transition:0s;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#sticky_menu_item_height' ).not( ':last' ).remove();
|
||||
jQuery( 'style#sticky_menu_item_logo_height' ).not( ':last' ).remove();
|
||||
jQuery( 'style#sticky_menu_item_height_transition' ).remove();
|
||||
}, 200 );
|
||||
|
||||
} );
|
||||
} );
|
||||
|
||||
// Disable the transition while we resize
|
||||
wp.customize( 'generate_spacing_settings[menu_item_height]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
|
||||
jQuery( 'head' ).append( '<style id="menu_item_height_transition">.main-navigation .main-nav ul li a,.menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation.sticky-navigation-transition .menu-bar-item > a,.main-navigation .navigation-logo img, .main-navigation .navigation-branding > *{transition:0s;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#menu_item_height_transition' ).remove();
|
||||
}, 200 );
|
||||
|
||||
} );
|
||||
} );
|
||||
|
||||
wp.customize( 'generate_spacing_settings[off_canvas_menu_item_height]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
|
||||
jQuery( 'head' ).append( '<style id="off_canvas_menu_item_height_transition">.main-navigation .main-nav ul li a,.menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation.sticky-navigation-transition .menu-bar-item > a,.main-navigation .navigation-logo img, .main-navigation .navigation-branding > *{transition:0s;}</style>' );
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#off_canvas_menu_item_height_transition' ).remove();
|
||||
}, 200 );
|
||||
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Widget padding
|
||||
*/
|
||||
generate_spacing_live_update( 'widget_top', 'widget_top', '.widget-area .widget, .one-container .widget-area .widget', 'padding-top', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'widget_right', 'widget_right', '.widget-area .widget, .one-container .widget-area .widget', 'padding-right', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'widget_bottom', 'widget_bottom', '.widget-area .widget, .one-container .widget-area .widget', 'padding-bottom', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'widget_left', 'widget_left', '.widget-area .widget, .one-container .widget-area .widget', 'padding-left', false, false, gp_spacing.desktop );
|
||||
|
||||
generate_spacing_live_update( 'mobile_widget_top', 'mobile_widget_top', '.widget-area .widget', 'padding-top', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_widget_right', 'mobile_widget_right', '.widget-area .widget', 'padding-right', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_widget_bottom', 'mobile_widget_bottom', '.widget-area .widget', 'padding-bottom', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_widget_left', 'mobile_widget_left', '.widget-area .widget', 'padding-left', false, false, gp_spacing.mobile );
|
||||
|
||||
|
||||
if ( gp_spacing.isFlex ) {
|
||||
/**
|
||||
* Footer widget area
|
||||
*/
|
||||
generate_spacing_live_update( 'footer_widget_container_top', 'footer_widget_container_top', '.footer-widgets-container', 'padding-top', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'footer_widget_container_right', 'footer_widget_container_right', '.footer-widgets-container', 'padding-right', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'footer_widget_container_bottom', 'footer_widget_container_bottom', '.footer-widgets-container', 'padding-bottom', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'footer_widget_container_left', 'footer_widget_container_left', '.footer-widgets-container', 'padding-left', false, false, gp_spacing.desktop );
|
||||
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_top', 'mobile_footer_widget_container_top', '.footer-widgets-container', 'padding-top', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_right', 'mobile_footer_widget_container_right', '.footer-widgets-container', 'padding-right', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_bottom', 'mobile_footer_widget_container_bottom', '.footer-widgets-container', 'padding-bottom', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_left', 'mobile_footer_widget_container_left', '.footer-widgets-container', 'padding-left', false, false, gp_spacing.mobile );
|
||||
|
||||
/**
|
||||
* Footer
|
||||
*/
|
||||
generate_spacing_live_update( 'footer_top', 'footer_top', '.inside-site-info', 'padding-top' );
|
||||
generate_spacing_live_update( 'footer_right', 'footer_right', '.inside-site-info', 'padding-right' );
|
||||
generate_spacing_live_update( 'footer_bottom', 'footer_bottom', '.inside-site-info', 'padding-bottom' );
|
||||
generate_spacing_live_update( 'footer_left', 'footer_left', '.inside-site-info', 'padding-left' );
|
||||
} else {
|
||||
/**
|
||||
* Footer widget area
|
||||
*/
|
||||
generate_spacing_live_update( 'footer_widget_container_top', 'footer_widget_container_top', '.footer-widgets', 'padding-top', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'footer_widget_container_right', 'footer_widget_container_right', '.footer-widgets', 'padding-right', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'footer_widget_container_bottom', 'footer_widget_container_bottom', '.footer-widgets', 'padding-bottom', false, false, gp_spacing.desktop );
|
||||
generate_spacing_live_update( 'footer_widget_container_left', 'footer_widget_container_left', '.footer-widgets', 'padding-left', false, false, gp_spacing.desktop );
|
||||
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_top', 'mobile_footer_widget_container_top', '.footer-widgets', 'padding-top', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_right', 'mobile_footer_widget_container_right', '.footer-widgets', 'padding-right', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_bottom', 'mobile_footer_widget_container_bottom', '.footer-widgets', 'padding-bottom', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_footer_widget_container_left', 'mobile_footer_widget_container_left', '.footer-widgets', 'padding-left', false, false, gp_spacing.mobile );
|
||||
|
||||
/**
|
||||
* Footer
|
||||
*/
|
||||
generate_spacing_live_update( 'footer_top', 'footer_top', '.site-info', 'padding-top' );
|
||||
generate_spacing_live_update( 'footer_right', 'footer_right', '.site-info', 'padding-right' );
|
||||
generate_spacing_live_update( 'footer_bottom', 'footer_bottom', '.site-info', 'padding-bottom' );
|
||||
generate_spacing_live_update( 'footer_left', 'footer_left', '.site-info', 'padding-left' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Separator
|
||||
*/
|
||||
|
||||
/* Masonry */
|
||||
if ( jQuery( 'body' ).hasClass( 'masonry-enabled' ) ) {
|
||||
generate_spacing_live_update( 'masonry_separator', 'separator', '.masonry-post .inside-article', 'margin-left' );
|
||||
generate_spacing_live_update( 'masonry_separator_bottom', 'separator', '.masonry-container > article', 'margin-bottom' );
|
||||
generate_spacing_live_update( 'masonry_separator_container', 'separator', '.masonry-container', 'margin-left', 'negative' );
|
||||
generate_spacing_live_update( 'masonry_separator_page_header_left', 'separator', '.masonry-enabled .page-header', 'margin-left' );
|
||||
generate_spacing_live_update( 'masonry_separator_page_header_bottom', 'separator', '.masonry-enabled .page-header', 'margin-bottom' );
|
||||
generate_spacing_live_update( 'masonry_separator_load_more', 'separator', '.separate-containers .site-main > .masonry-load-more', 'margin-bottom' );
|
||||
}
|
||||
|
||||
/* Columns */
|
||||
if ( jQuery( 'body' ).hasClass( 'generate-columns-activated' ) ) {
|
||||
generate_spacing_live_update( 'columns_bottom', 'separator', '.generate-columns', 'margin-bottom' );
|
||||
generate_spacing_live_update( 'columns_left', 'separator', '.generate-columns', 'padding-left' );
|
||||
generate_spacing_live_update( 'columns_container', 'separator', '.generate-columns-container', 'margin-left', 'negative' );
|
||||
generate_spacing_live_update( 'columns_page_header_bottom', 'separator', '.generate-columns-container .page-header', 'margin-bottom' );
|
||||
generate_spacing_live_update( 'columns_page_header_left', 'separator', '.generate-columns-container .page-header', 'margin-left' );
|
||||
generate_spacing_live_update( 'columns_pagination', 'separator', '.separate-containers .generate-columns-container > .paging-navigation', 'margin-left' );
|
||||
}
|
||||
|
||||
/* Right sidebar */
|
||||
if ( jQuery( 'body' ).hasClass( 'right-sidebar' ) ) {
|
||||
generate_spacing_live_update( 'right_sidebar_sepatator_top', 'separator', '.right-sidebar.separate-containers .site-main', 'margin-top' );
|
||||
generate_spacing_live_update( 'right_sidebar_sepatator_right', 'separator', '.right-sidebar.separate-containers .site-main', 'margin-right' );
|
||||
generate_spacing_live_update( 'right_sidebar_sepatator_bottom', 'separator', '.right-sidebar.separate-containers .site-main', 'margin-bottom' );
|
||||
}
|
||||
|
||||
/* Left sidebar */
|
||||
if ( jQuery( 'body' ).hasClass( 'left-sidebar' ) ) {
|
||||
generate_spacing_live_update( 'left_sidebar_sepatator_top', 'separator', '.left-sidebar.separate-containers .site-main', 'margin-top' );
|
||||
generate_spacing_live_update( 'left_sidebar_sepatator_left', 'separator', '.left-sidebar.separate-containers .site-main', 'margin-left' );
|
||||
generate_spacing_live_update( 'left_sidebar_sepatator_bottom', 'separator', '.left-sidebar.separate-containers .site-main', 'margin-bottom' );
|
||||
}
|
||||
|
||||
/* Both sidebars */
|
||||
if ( jQuery( 'body' ).hasClass( 'both-sidebars' ) ) {
|
||||
generate_spacing_live_update( 'both_sidebars_sepatator', 'separator', '.both-sidebars.separate-containers .site-main', 'margin' );
|
||||
}
|
||||
|
||||
/* Both sidebars right */
|
||||
if ( jQuery( 'body' ).hasClass( 'both-right' ) ) {
|
||||
generate_spacing_live_update( 'both_right_sidebar_sepatator_top', 'separator', '.both-right.separate-containers .site-main', 'margin-top' );
|
||||
generate_spacing_live_update( 'both_right_sidebar_sepatator_right', 'separator', '.both-right.separate-containers .site-main', 'margin-right' );
|
||||
generate_spacing_live_update( 'both_right_sidebar_sepatator_bottom', 'separator', '.both-right.separate-containers .site-main', 'margin-bottom' );
|
||||
|
||||
if ( gp_spacing.isFlex ) {
|
||||
generate_spacing_live_update( 'both_right_left_sidebar', 'separator', '.both-right .inside-left-sidebar', 'margin-right', false, true );
|
||||
generate_spacing_live_update( 'both_right_right_sidebar', 'separator', '.both-right .inside-right-sidebar', 'margin-left', false, true );
|
||||
} else {
|
||||
generate_spacing_live_update( 'both_right_left_sidebar', 'separator', '.both-right.separate-containers .inside-left-sidebar', 'margin-right', false, true );
|
||||
generate_spacing_live_update( 'both_right_right_sidebar', 'separator', '.both-right.separate-containers .inside-right-sidebar', 'margin-left', false, true );
|
||||
}
|
||||
}
|
||||
|
||||
/* Both sidebars left */
|
||||
if ( jQuery( 'body' ).hasClass( 'both-left' ) ) {
|
||||
generate_spacing_live_update( 'both_left_sidebar_sepatator_top', 'separator', '.both-left.separate-containers .site-main', 'margin-top' );
|
||||
generate_spacing_live_update( 'both_left_sidebar_sepatator_right', 'separator', '.both-left.separate-containers .site-main', 'margin-bottom' );
|
||||
generate_spacing_live_update( 'both_left_sidebar_sepatator_bottom', 'separator', '.both-left.separate-containers .site-main', 'margin-left' );
|
||||
|
||||
if ( gp_spacing.isFlex ) {
|
||||
generate_spacing_live_update( 'both_left_left_sidebar', 'separator', '.both-left .inside-left-sidebar', 'margin-right', false, true );
|
||||
generate_spacing_live_update( 'both_left_right_sidebar', 'separator', '.both-left .inside-right-sidebar', 'margin-left', false, true );
|
||||
} else {
|
||||
generate_spacing_live_update( 'both_left_left_sidebar', 'separator', '.both-left.separate-containers .inside-left-sidebar', 'margin-right', false, true );
|
||||
generate_spacing_live_update( 'both_left_right_sidebar', 'separator', '.both-left.separate-containers .inside-right-sidebar', 'margin-left', false, true );
|
||||
}
|
||||
}
|
||||
|
||||
/* Main element margin */
|
||||
generate_spacing_live_update( 'site_main_separator_top', 'separator', '.separate-containers .site-main', 'margin-top' );
|
||||
generate_spacing_live_update( 'site_main_separator_bottom', 'separator', '.separate-containers .site-main', 'margin-bottom' );
|
||||
|
||||
/* Page header element */
|
||||
if ( gp_spacing.isFlex ) {
|
||||
generate_spacing_live_update( 'page_header_separator_top', 'separator', '.separate-containers .featured-image', 'margin-top' );
|
||||
} else {
|
||||
generate_spacing_live_update( 'page_header_separator_top', 'separator',
|
||||
'.separate-containers .page-header-image, \
|
||||
.separate-containers .page-header-contained, \
|
||||
.separate-containers .page-header-image-single, \
|
||||
.separate-containers .page-header-content-single', 'margin-top' );
|
||||
}
|
||||
|
||||
/* Top and bottom sidebar margin */
|
||||
generate_spacing_live_update( 'right_sidebar_separator_top', 'separator', '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar', 'margin-top' );
|
||||
generate_spacing_live_update( 'right_sidebar_separator_bottom', 'separator', '.separate-containers .inside-right-sidebar, .separate-containers .inside-left-sidebar', 'margin-bottom' );
|
||||
|
||||
/* Element separators */
|
||||
if ( gp_spacing.isFlex ) {
|
||||
generate_spacing_live_update( 'content_separator', 'separator',
|
||||
'.sidebar .widget, \
|
||||
.site-main > *, \
|
||||
.page-header, \
|
||||
.widget-area .main-navigation', 'margin-bottom' );
|
||||
} else {
|
||||
generate_spacing_live_update( 'content_separator', 'separator',
|
||||
'.separate-containers .widget, \
|
||||
.separate-containers .site-main > *, \
|
||||
.separate-containers .page-header, \
|
||||
.widget-area .main-navigation', 'margin-bottom' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Right sidebar width
|
||||
*/
|
||||
wp.customize( 'generate_spacing_settings[right_sidebar_width]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
var body = jQuery( 'body' );
|
||||
|
||||
if ( jQuery( '#right-sidebar' ).length ) {
|
||||
if ( gp_spacing.isFlex ) {
|
||||
var contentWidth = 100,
|
||||
leftSidebar = jQuery( '#left-sidebar' ).length ? wp.customize.value('generate_spacing_settings[left_sidebar_width]')() : 0;
|
||||
|
||||
if ( body.hasClass( 'right-sidebar' ) ) {
|
||||
contentWidth = ( Number( contentWidth ) - Number( newval ) );
|
||||
} else if ( ! body.hasClass( 'left-sidebar' ) && ! body.hasClass( 'no-sidebar' ) ) {
|
||||
var totalSidebarWidth = ( Number( leftSidebar ) + Number( newval ) );
|
||||
|
||||
contentWidth = ( Number( contentWidth ) - Number( totalSidebarWidth ) );
|
||||
}
|
||||
|
||||
jQuery( 'head' ).append( '<style id="right_sidebar_width">.is-right-sidebar{width:' + newval + '%;}.site-content .content-area{width:' + contentWidth + '%;}</style>' );
|
||||
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#right_sidebar_width' ).not( ':last' ).remove();
|
||||
}, 200 );
|
||||
} 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' );
|
||||
|
||||
// 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-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( '#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');
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Left sidebar width
|
||||
*/
|
||||
wp.customize( 'generate_spacing_settings[left_sidebar_width]', function( value ) {
|
||||
value.bind( function( newval ) {
|
||||
var body = jQuery( 'body' );
|
||||
if ( jQuery( '#left-sidebar' ).length ) {
|
||||
if ( gp_spacing.isFlex ) {
|
||||
var contentWidth = 100,
|
||||
rightSidebar = jQuery( '#right-sidebar' ).length ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0;
|
||||
|
||||
if ( body.hasClass( 'left-sidebar' ) ) {
|
||||
contentWidth = ( Number( contentWidth ) - Number( newval ) );
|
||||
} else if ( ! body.hasClass( 'right-sidebar' ) && ! body.hasClass( 'no-sidebar' ) ) {
|
||||
var totalSidebarWidth = ( Number( rightSidebar ) + Number( newval ) );
|
||||
|
||||
contentWidth = ( Number( contentWidth ) - Number( totalSidebarWidth ) );
|
||||
}
|
||||
|
||||
jQuery( 'head' ).append( '<style id="left_sidebar_width">.is-left-sidebar{width:' + newval + '%;}.site-content .content-area{width:' + contentWidth + '%;}</style>' );
|
||||
|
||||
setTimeout(function() {
|
||||
jQuery( 'style#left_sidebar_width' ).not( ':last' ).remove();
|
||||
}, 200 );
|
||||
} else {
|
||||
// Right sidebar width
|
||||
var right_sidebar = ( jQuery( '#right-sidebar' ).length ) ? wp.customize.value('generate_spacing_settings[right_sidebar_width]')() : 0;
|
||||
|
||||
// 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' );
|
||||
|
||||
// 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' );
|
||||
|
||||
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 ) );
|
||||
|
||||
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( '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 ) );
|
||||
}
|
||||
|
||||
if ( body.hasClass( 'both-left' ) ) {
|
||||
var content_width = ( 100 - newval - right_sidebar );
|
||||
var total_sidebar_width = ( parseInt( right_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( '#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');
|
||||
}
|
||||
} );
|
||||
} );
|
@ -0,0 +1,281 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the navigation spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[menu_item]',
|
||||
array(
|
||||
'default' => $defaults['menu_item'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[menu_item]',
|
||||
array(
|
||||
'label' => __( 'Menu Item Width', 'gp-premium' ),
|
||||
'section' => $navigation_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[menu_item]',
|
||||
'mobile' => 'generate_spacing_settings[mobile_menu_item]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
'mobile' => array(
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 220,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Menu item height.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[menu_item_height]',
|
||||
array(
|
||||
'default' => $defaults['menu_item_height'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[menu_item_height]',
|
||||
array(
|
||||
'label' => __( 'Menu Item Height', 'gp-premium' ),
|
||||
'section' => $navigation_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[menu_item_height]',
|
||||
'mobile' => 'generate_spacing_settings[mobile_menu_item_height]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 20,
|
||||
'max' => 150,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
'mobile' => array(
|
||||
'min' => 20,
|
||||
'max' => 150,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 240,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Sub-menu item height.
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[sub_menu_item_height]',
|
||||
array(
|
||||
'label' => __( 'Sub-Menu Item Height', 'gp-premium' ),
|
||||
'section' => $navigation_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[sub_menu_item_height]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 260,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( isset( $defaults['sub_menu_width'] ) ) {
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[sub_menu_width]',
|
||||
array(
|
||||
'default' => $defaults['sub_menu_width'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[sub_menu_width]',
|
||||
array(
|
||||
'label' => __( 'Sub-Menu Width', 'gp-premium' ),
|
||||
'section' => $navigation_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[sub_menu_width]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 100,
|
||||
'max' => 500,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 265,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Sticky menu height.
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[sticky_menu_item_height]',
|
||||
array(
|
||||
'label' => __( 'Menu Item Height', 'gp-premium' ),
|
||||
'section' => 'menu_plus_sticky_menu',
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[sticky_menu_item_height]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 20,
|
||||
'max' => 150,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 150,
|
||||
'active_callback' => 'generate_sticky_navigation_activated',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Off canvas menu height.
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[off_canvas_menu_item_height]',
|
||||
array(
|
||||
'label' => __( 'Menu Item Height', 'gp-premium' ),
|
||||
'section' => 'menu_plus_slideout_menu',
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[off_canvas_menu_item_height]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 20,
|
||||
'max' => 150,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 200,
|
||||
'active_callback' => 'generate_slideout_navigation_activated',
|
||||
)
|
||||
)
|
||||
);
|
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the secondary navigation spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_secondary_nav_customizer' ) ) {
|
||||
add_action( 'customize_register', 'generate_spacing_secondary_nav_customizer', 1000 );
|
||||
/**
|
||||
* Adds our Secondary Nav spacing options
|
||||
*
|
||||
* These options are in their own function so we can hook it in late to
|
||||
* make sure Secondary Nav is activated.
|
||||
*
|
||||
* 1000 priority is there to make sure Secondary Nav is registered (999)
|
||||
* 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.
|
||||
if ( ! function_exists( 'generate_secondary_nav_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure Secondary Nav is activated.
|
||||
if ( ! $wp_customize->get_section( 'secondary_nav_section' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our controls.
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
// 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' );
|
||||
}
|
||||
|
||||
// Menu item width.
|
||||
$wp_customize->add_setting(
|
||||
'generate_secondary_nav_settings[secondary_menu_item]',
|
||||
array(
|
||||
'default' => $defaults['secondary_menu_item'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_nav_settings[secondary_menu_item]',
|
||||
array(
|
||||
'label' => __( 'Menu Item Width', 'gp-premium' ),
|
||||
'section' => 'secondary_nav_section',
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_secondary_nav_settings[secondary_menu_item]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 220,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Menu item height.
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_nav_settings[secondary_menu_item_height]',
|
||||
array(
|
||||
'label' => __( 'Menu Item Height', 'gp-premium' ),
|
||||
'section' => 'secondary_nav_section',
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_secondary_nav_settings[secondary_menu_item_height]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 20,
|
||||
'max' => 150,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 240,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Sub-menu height.
|
||||
$wp_customize->add_setting(
|
||||
'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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_secondary_nav_settings[secondary_sub_menu_item_height]',
|
||||
array(
|
||||
'label' => __( 'Sub-Menu Item Height', 'gp-premium' ),
|
||||
'section' => 'secondary_nav_section',
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_secondary_nav_settings[secondary_sub_menu_item_height]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 0,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
'edit' => true,
|
||||
'unit' => 'px',
|
||||
),
|
||||
),
|
||||
'priority' => 260,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the sidebar spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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]',
|
||||
array(
|
||||
'default' => $defaults['widget_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Widget padding right.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[widget_right]',
|
||||
array(
|
||||
'default' => $defaults['widget_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Widget padding bottom.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[widget_bottom]',
|
||||
array(
|
||||
'default' => $defaults['widget_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// Widget padding left.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[widget_left]',
|
||||
array(
|
||||
'default' => $defaults['widget_left'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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',
|
||||
)
|
||||
);
|
||||
|
||||
// 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(
|
||||
'desktop_top' => 'generate_spacing_settings[widget_top]',
|
||||
'desktop_right' => 'generate_spacing_settings[widget_right]',
|
||||
'desktop_bottom' => 'generate_spacing_settings[widget_bottom]',
|
||||
'desktop_left' => 'generate_spacing_settings[widget_left]',
|
||||
'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]',
|
||||
),
|
||||
'element' => 'widget',
|
||||
'priority' => 99,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Left sidebar width.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[left_sidebar_width]',
|
||||
array(
|
||||
'default' => $defaults['left_sidebar_width'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[left_sidebar_width]',
|
||||
array(
|
||||
'label' => esc_html__( 'Left Sidebar Width', 'gp-premium' ),
|
||||
'section' => $widget_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[left_sidebar_width]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 15,
|
||||
'max' => 50,
|
||||
'step' => 5,
|
||||
'edit' => false,
|
||||
'unit' => '%',
|
||||
),
|
||||
),
|
||||
'priority' => 125,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Right sidebar width.
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[right_sidebar_width]',
|
||||
array(
|
||||
'default' => $defaults['right_sidebar_width'],
|
||||
'type' => 'option',
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new GeneratePress_Pro_Range_Slider_Control(
|
||||
$wp_customize,
|
||||
'generate_spacing_settings[right_sidebar_width]',
|
||||
array(
|
||||
'label' => esc_html__( 'Right Sidebar Width', 'gp-premium' ),
|
||||
'section' => $widget_section,
|
||||
'settings' => array(
|
||||
'desktop' => 'generate_spacing_settings[right_sidebar_width]',
|
||||
),
|
||||
'choices' => array(
|
||||
'desktop' => array(
|
||||
'min' => 15,
|
||||
'max' => 50,
|
||||
'step' => 5,
|
||||
'edit' => false,
|
||||
'unit' => '%',
|
||||
),
|
||||
),
|
||||
'priority' => 125,
|
||||
)
|
||||
)
|
||||
);
|
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the top bar spacing Customizer options.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
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',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[top_bar_right]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[top_bar_bottom]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'generate_spacing_settings[top_bar_left]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_left'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
)
|
||||
);
|
||||
|
||||
$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(
|
||||
'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]',
|
||||
),
|
||||
'element' => 'top_bar',
|
||||
'priority' => 99,
|
||||
'active_callback' => 'generate_premium_is_top_bar_active',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
@ -0,0 +1,362 @@
|
||||
<?php
|
||||
/**
|
||||
* This file handles the Spacing module functionality.
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Add any necessary functions.
|
||||
require_once plugin_dir_path( __FILE__ ) . 'migration.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/secondary-nav-spacing.php';
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_customize_register' ) ) {
|
||||
add_action( 'customize_register', 'generate_spacing_customize_register', 99 );
|
||||
/**
|
||||
* Add our spacing Customizer options
|
||||
*
|
||||
* @since 0.1
|
||||
* @param object $wp_customize The Customizer object.
|
||||
*/
|
||||
function generate_spacing_customize_register( $wp_customize ) {
|
||||
// Bail if we don't have our defaults.
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||
|
||||
$defaults = generate_spacing_get_defaults();
|
||||
|
||||
// Register our custom control types.
|
||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||
$wp_customize->register_control_type( 'GeneratePress_Pro_Range_Slider_Control' );
|
||||
$wp_customize->register_control_type( 'GeneratePress_Spacing_Control' );
|
||||
}
|
||||
|
||||
// Add our Spacing panel.
|
||||
// This is only used if the Layout panel in the free theme doesn't exist.
|
||||
if ( class_exists( 'WP_Customize_Panel' ) ) {
|
||||
if ( ! $wp_customize->get_panel( 'generate_spacing_panel' ) ) {
|
||||
$wp_customize->add_panel(
|
||||
'generate_spacing_panel',
|
||||
array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'theme_supports' => '',
|
||||
'title' => __( 'Spacing', 'gp-premium' ),
|
||||
'description' => __( 'Change the spacing for various elements using pixels.', 'gp-premium' ),
|
||||
'priority' => 35,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/top-bar-spacing.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/header-spacing.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/content-spacing.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/sidebar-spacing.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/navigation-spacing.php';
|
||||
require_once plugin_dir_path( __FILE__ ) . 'customizer/footer-spacing.php';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_right_sidebar_width' ) ) {
|
||||
add_filter( 'generate_right_sidebar_width', 'generate_right_sidebar_width' );
|
||||
/**
|
||||
* Set our right sidebar width.
|
||||
*
|
||||
* @param int $width The sidebar width.
|
||||
*/
|
||||
function generate_right_sidebar_width( $width ) {
|
||||
// Bail if we don't have our defaults.
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
return $width;
|
||||
}
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
return absint( $spacing_settings['right_sidebar_width'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_left_sidebar_width' ) ) {
|
||||
add_filter( 'generate_left_sidebar_width', 'generate_left_sidebar_width' );
|
||||
/**
|
||||
* Set our left sidebar width.
|
||||
*
|
||||
* @param int $width The sidebar width.
|
||||
*/
|
||||
function generate_left_sidebar_width( $width ) {
|
||||
// Bail if we don't have our defaults.
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
return $width;
|
||||
}
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
return absint( $spacing_settings['left_sidebar_width'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_customizer_live_preview' ) ) {
|
||||
add_action( 'customize_preview_init', 'generate_spacing_customizer_live_preview' );
|
||||
/**
|
||||
* Add our live preview JS
|
||||
*/
|
||||
function generate_spacing_customizer_live_preview() {
|
||||
wp_enqueue_script(
|
||||
'generate-spacing-customizer',
|
||||
trailingslashit( plugin_dir_url( __FILE__ ) ) . 'customizer/js/customizer.js',
|
||||
array( 'jquery', 'customize-preview' ),
|
||||
GENERATE_SPACING_VERSION,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'generate-spacing-customizer',
|
||||
'gp_spacing',
|
||||
array(
|
||||
'mobile' => generate_premium_get_media_query( 'mobile' ),
|
||||
'tablet' => generate_premium_get_media_query( 'tablet' ),
|
||||
'desktop' => generate_premium_get_media_query( 'desktop' ),
|
||||
'isFlex' => function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_include_spacing_defaults' ) ) {
|
||||
/**
|
||||
* Check if we should include our default.css file.
|
||||
*
|
||||
* @since 1.3.42
|
||||
*/
|
||||
function generate_include_spacing_defaults() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_premium_defaults' ) ) {
|
||||
add_filter( 'generate_spacing_option_defaults', 'generate_spacing_premium_defaults' );
|
||||
/**
|
||||
* Add premium spacing defaults.
|
||||
*
|
||||
* @since 1.3
|
||||
* @param array $defaults The existing defaults.
|
||||
*/
|
||||
function generate_spacing_premium_defaults( $defaults ) {
|
||||
$defaults['mobile_menu_item'] = '';
|
||||
$defaults['mobile_menu_item_height'] = '';
|
||||
$defaults['sticky_menu_item_height'] = '';
|
||||
$defaults['off_canvas_menu_item_height'] = '';
|
||||
$defaults['content_element_separator'] = '2'; // em.
|
||||
|
||||
// These defaults were added to GeneratePress (free) in 3.0.0.
|
||||
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '<' ) ) {
|
||||
$defaults['mobile_header_top'] = '';
|
||||
$defaults['mobile_header_right'] = '';
|
||||
$defaults['mobile_header_bottom'] = '';
|
||||
$defaults['mobile_header_left'] = '';
|
||||
|
||||
$defaults['mobile_widget_top'] = '';
|
||||
$defaults['mobile_widget_right'] = '';
|
||||
$defaults['mobile_widget_bottom'] = '';
|
||||
$defaults['mobile_widget_left'] = '';
|
||||
|
||||
$defaults['mobile_footer_widget_container_top'] = '';
|
||||
$defaults['mobile_footer_widget_container_right'] = '';
|
||||
$defaults['mobile_footer_widget_container_bottom'] = '';
|
||||
$defaults['mobile_footer_widget_container_left'] = '';
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build our premium CSS.
|
||||
*/
|
||||
function generate_spacing_do_premium_css() {
|
||||
// Bail if we don't have our defaults.
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
require_once GP_LIBRARY_DIRECTORY . 'class-make-css.php';
|
||||
$premium_css = new GeneratePress_Pro_CSS();
|
||||
$css_output = '';
|
||||
|
||||
// Mobile spacing.
|
||||
$premium_css->start_media_query( generate_premium_get_media_query( 'mobile-menu' ) );
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_menu_item'] ) {
|
||||
$premium_css->set_selector( '.main-navigation .menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation .menu-bar-item > a' );
|
||||
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_menu_item'] ), false, 'px' );
|
||||
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_menu_item'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_menu_item_height'] ) {
|
||||
$premium_css->set_selector( '.main-navigation .main-nav ul li a,.main-navigation .menu-toggle,.main-navigation .mobile-bar-items a,.main-navigation .menu-bar-item > a' );
|
||||
$premium_css->add_property( 'line-height', absint( $spacing_settings['mobile_menu_item_height'] ), false, 'px' );
|
||||
|
||||
$premium_css->set_selector( '.main-navigation .site-logo.navigation-logo img, .mobile-header-navigation .site-logo.mobile-header-logo img, .navigation-search input[type="search"]' );
|
||||
$premium_css->add_property( 'height', absint( $spacing_settings['mobile_menu_item_height'] ), false, 'px' );
|
||||
}
|
||||
|
||||
$premium_css->stop_media_query();
|
||||
|
||||
// This CSS was added to GeneratePress (free) in 3.0.0.
|
||||
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '<' ) ) {
|
||||
$premium_css->start_media_query( generate_premium_get_media_query( 'mobile' ) );
|
||||
|
||||
$premium_css->set_selector( '.inside-header' );
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_header_top'] ) {
|
||||
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_header_top'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_header_right'] ) {
|
||||
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_header_right'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_header_bottom'] ) {
|
||||
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_header_bottom'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_header_left'] ) {
|
||||
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_header_left'] ), false, 'px' );
|
||||
}
|
||||
|
||||
$premium_css->set_selector( '.widget-area .widget' );
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_widget_top'] ) {
|
||||
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_widget_top'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_widget_right'] ) {
|
||||
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_widget_right'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_widget_bottom'] ) {
|
||||
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_widget_bottom'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_widget_left'] ) {
|
||||
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_widget_left'] ), false, 'px' );
|
||||
}
|
||||
|
||||
$premium_css->set_selector( '.footer-widgets' );
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_footer_widget_container_top'] ) {
|
||||
$premium_css->add_property( 'padding-top', absint( $spacing_settings['mobile_footer_widget_container_top'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_footer_widget_container_right'] ) {
|
||||
$premium_css->add_property( 'padding-right', absint( $spacing_settings['mobile_footer_widget_container_right'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_footer_widget_container_bottom'] ) {
|
||||
$premium_css->add_property( 'padding-bottom', absint( $spacing_settings['mobile_footer_widget_container_bottom'] ), false, 'px' );
|
||||
}
|
||||
|
||||
if ( '' !== $spacing_settings['mobile_footer_widget_container_left'] ) {
|
||||
$premium_css->add_property( 'padding-left', absint( $spacing_settings['mobile_footer_widget_container_left'] ), false, 'px' );
|
||||
}
|
||||
|
||||
$premium_css->stop_media_query();
|
||||
|
||||
$premium_css->set_selector( '.post-image, .page-content, .entry-content, .entry-summary, footer.entry-meta' );
|
||||
$premium_css->add_property( 'margin-top', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
|
||||
} else {
|
||||
$premium_css->set_selector( '.post-image:not(:first-child), .page-content:not(:first-child), .entry-content:not(:first-child), .entry-summary:not(:first-child), footer.entry-meta' );
|
||||
$premium_css->add_property( 'margin-top', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
|
||||
}
|
||||
|
||||
$premium_css->set_selector( '.post-image-above-header .inside-article div.featured-image, .post-image-above-header .inside-article div.post-image' );
|
||||
$premium_css->add_property( 'margin-bottom', floatval( $spacing_settings['content_element_separator'] ), '2', 'em' );
|
||||
|
||||
if ( function_exists( 'generate_menu_plus_get_defaults' ) ) {
|
||||
$menu_plus = wp_parse_args(
|
||||
get_option( 'generate_menu_plus_settings', array() ),
|
||||
generate_menu_plus_get_defaults()
|
||||
);
|
||||
|
||||
if ( 'false' !== $menu_plus['sticky_menu'] && '' !== $spacing_settings['sticky_menu_item_height'] ) {
|
||||
$premium_css->start_media_query( generate_premium_get_media_query( 'tablet' ) . ',' . generate_premium_get_media_query( 'desktop' ) );
|
||||
|
||||
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
|
||||
$premium_css->set_selector( '.main-navigation.sticky-navigation-transition .main-nav > ul > li > a,.sticky-navigation-transition .menu-toggle,.main-navigation.sticky-navigation-transition .menu-bar-item > a, .sticky-navigation-transition .navigation-branding .main-title' );
|
||||
} else {
|
||||
$premium_css->set_selector( '.main-navigation.sticky-navigation-transition .main-nav > ul > li > a,.sticky-navigation-transition .menu-toggle,.main-navigation.sticky-navigation-transition .mobile-bar-items a, .sticky-navigation-transition .navigation-branding .main-title' );
|
||||
}
|
||||
|
||||
$premium_css->add_property( 'line-height', absint( $spacing_settings['sticky_menu_item_height'] ), false, 'px' );
|
||||
|
||||
$premium_css->set_selector( '.main-navigation.sticky-navigation-transition .site-logo img, .main-navigation.sticky-navigation-transition .navigation-search input[type="search"], .main-navigation.sticky-navigation-transition .navigation-branding img' );
|
||||
$premium_css->add_property( 'height', absint( $spacing_settings['sticky_menu_item_height'] ), false, 'px' );
|
||||
|
||||
$premium_css->stop_media_query();
|
||||
}
|
||||
|
||||
if ( 'false' !== $menu_plus['slideout_menu'] ) {
|
||||
$premium_css->set_selector( '.main-navigation.slideout-navigation .main-nav > ul > li > a' );
|
||||
if ( '' !== $spacing_settings['off_canvas_menu_item_height'] ) {
|
||||
$premium_css->add_property( 'line-height', absint( $spacing_settings['off_canvas_menu_item_height'] ), false, 'px' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( '' !== $premium_css->css_output() ) {
|
||||
$css_output = $premium_css->css_output();
|
||||
}
|
||||
|
||||
return $css_output;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_premium_css' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', 'generate_spacing_premium_css', 105 );
|
||||
/**
|
||||
* Add premium spacing CSS
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
function generate_spacing_premium_css() {
|
||||
$css = generate_spacing_do_premium_css();
|
||||
|
||||
if ( 'inline' === generate_get_css_print_method() && $css ) {
|
||||
wp_add_inline_style( 'generate-style', $css );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'generate_external_dynamic_css_output', 'generate_spacing_add_to_external_stylesheet' );
|
||||
/**
|
||||
* Add CSS to the external stylesheet.
|
||||
*
|
||||
* @since 1.11.0
|
||||
* @param string $css Existing CSS.
|
||||
*/
|
||||
function generate_spacing_add_to_external_stylesheet( $css ) {
|
||||
if ( 'inline' === generate_get_css_print_method() ) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
$css .= generate_spacing_do_premium_css();
|
||||
|
||||
return $css;
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_update_footer_padding' ) ) {
|
||||
add_action( 'admin_init', 'generate_spacing_update_footer_padding' );
|
||||
/**
|
||||
* If our footer widget area has the old default 0 for left and right, set it to 40
|
||||
* @since 1.3.42
|
||||
* December 19, 2016
|
||||
*/
|
||||
function generate_spacing_update_footer_padding() {
|
||||
// Bail if GP isn't activated
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our migration settings
|
||||
$settings = get_option( 'generate_migration_settings', array() );
|
||||
|
||||
// If we've already ran this function, bail
|
||||
if ( isset( $settings[ 'footer_padding_updated' ] ) && 'true' == $settings[ 'footer_padding_updated' ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our spacing settings
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
// If we don't have a footer widget separator, we don't need to do this
|
||||
if ( ! isset( $spacing_settings[ 'footer_widget_separator' ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We're still here, update our left and right footer widget area padding if they're set to 0
|
||||
if ( '0' == $spacing_settings[ 'footer_widget_container_right' ] && '0' == $spacing_settings[ 'footer_widget_container_left' ] ) {
|
||||
$new_settings[ 'footer_widget_container_right' ] = '40';
|
||||
$new_settings[ 'footer_widget_container_left' ] = '40';
|
||||
$update_settings = wp_parse_args( $new_settings, $spacing_settings );
|
||||
update_option( 'generate_spacing_settings', $update_settings );
|
||||
}
|
||||
|
||||
// Update our migration option so we don't need to run this again
|
||||
$updated[ 'footer_padding_updated' ] = 'true';
|
||||
$migration_settings = wp_parse_args( $updated, $settings );
|
||||
update_option( 'generate_migration_settings', $migration_settings );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'generate_spacing_update_mobile_content_padding' ) ) {
|
||||
add_action( 'admin_init', 'generate_spacing_update_mobile_content_padding' );
|
||||
/**
|
||||
* Mobile content padding used to be one option.
|
||||
* Now we use 4, so we need to grab our mobile content padding option and set it to all 4 areas.
|
||||
* @since 1.3.45
|
||||
* Febuary 20, 2017
|
||||
*/
|
||||
function generate_spacing_update_mobile_content_padding() {
|
||||
// Bail if GP isn't activated
|
||||
if ( ! function_exists( 'generate_spacing_get_defaults' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our migration settings
|
||||
$settings = get_option( 'generate_migration_settings', array() );
|
||||
|
||||
// If we've already ran this function, bail
|
||||
if ( isset( $settings[ 'mobile_content_padding_updated' ] ) && 'true' == $settings[ 'mobile_content_padding_updated' ] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get our spacing settings
|
||||
$spacing_settings = wp_parse_args(
|
||||
get_option( 'generate_spacing_settings', array() ),
|
||||
generate_spacing_get_defaults()
|
||||
);
|
||||
|
||||
// If we don't have the new mobile content padding options, bail
|
||||
if ( ! isset( $spacing_settings[ 'mobile_content_top' ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We're still here, update our mobile content padding options if they aren't set to 30 (default)
|
||||
if ( isset( $spacing_settings[ 'mobile_content_padding' ] ) && '30' !== $spacing_settings[ 'mobile_content_padding' ] ) {
|
||||
$new_settings[ 'mobile_content_top' ] = $spacing_settings[ 'mobile_content_padding' ];
|
||||
$new_settings[ 'mobile_content_right' ] = $spacing_settings[ 'mobile_content_padding' ];
|
||||
$new_settings[ 'mobile_content_bottom' ] = $spacing_settings[ 'mobile_content_padding' ];
|
||||
$new_settings[ 'mobile_content_left' ] = $spacing_settings[ 'mobile_content_padding' ];
|
||||
$update_settings = wp_parse_args( $new_settings, $spacing_settings );
|
||||
update_option( 'generate_spacing_settings', $update_settings );
|
||||
}
|
||||
|
||||
// Update our migration option so we don't need to run this again
|
||||
$updated[ 'mobile_content_padding_updated' ] = 'true';
|
||||
$migration_settings = wp_parse_args( $updated, $settings );
|
||||
update_option( 'generate_migration_settings', $migration_settings );
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* The Spacing module.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @package GP Premium
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // No direct access, please.
|
||||
}
|
||||
|
||||
// Define the version.
|
||||
if ( ! defined( 'GENERATE_SPACING_VERSION' ) ) {
|
||||
define( 'GENERATE_SPACING_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