Initial commit
This commit is contained in:
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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', 'generatepress' ),
|
||||
'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,190 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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,122 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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,551 @@
|
||||
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 );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
/* 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, .page-content, .entry-content, .entry-summary, 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,\
|
||||
.menu-toggle,\
|
||||
.main-navigation .mobile-bar-items 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', '.menu-toggle,.main-navigation .mobile-bar-items a', 'padding-left', false, false, gp_spacing.mobile );
|
||||
generate_spacing_live_update( 'mobile_menu_item_padding_right', 'mobile_menu_item', '.menu-toggle,.main-navigation .mobile-bar-items a', 'padding-right', false, false, gp_spacing.mobile );
|
||||
|
||||
// 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 .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 .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 .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 );
|
||||
|
||||
/**
|
||||
* 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', 'padding-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' );
|
||||
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' );
|
||||
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 */
|
||||
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 */
|
||||
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 ) {
|
||||
|
||||
// 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 ) {
|
||||
// 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,269 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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'] ) ) {
|
||||
// Sub-menu item height
|
||||
$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,147 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
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,196 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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,69 @@
|
||||
<?php
|
||||
// No direct access, please
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset( $defaults[ 'top_bar_top' ] ) ) {
|
||||
// Widget padding top
|
||||
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_top]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_top'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
// Widget padding right
|
||||
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_right]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_right'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
// Widget padding bottom
|
||||
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_bottom]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_bottom'],
|
||||
'type' => 'option',
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
// Widget padding left
|
||||
$wp_customize->add_setting( 'generate_spacing_settings[top_bar_left]',
|
||||
array(
|
||||
'default' => $defaults['top_bar_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,
|
||||
'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',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user