2020-04-07 13:03:04 +00:00
|
|
|
<?php
|
2020-08-13 14:53:39 +00:00
|
|
|
/**
|
|
|
|
* This file handles the header spacing Customizer options.
|
|
|
|
*
|
|
|
|
* @package GP Premium
|
|
|
|
*/
|
|
|
|
|
2020-04-07 13:03:04 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
2020-08-13 14:53:39 +00:00
|
|
|
exit; // No direct access, please.
|
2020-04-07 13:03:04 +00:00
|
|
|
}
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Add our old header section.
|
2020-04-07 13:03:04 +00:00
|
|
|
$wp_customize->add_section(
|
|
|
|
'generate_spacing_header',
|
|
|
|
array(
|
|
|
|
'title' => __( 'Header', 'gp-premium' ),
|
|
|
|
'capability' => 'edit_theme_options',
|
|
|
|
'priority' => 5,
|
2020-08-13 14:53:39 +00:00
|
|
|
'panel' => 'generate_spacing_panel',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// If we don't have a layout panel, use our old spacing section.
|
2020-04-07 13:03:04 +00:00
|
|
|
$header_section = ( $wp_customize->get_panel( 'generate_layout_panel' ) ) ? 'generate_layout_header' : 'generate_spacing_header';
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header top.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[header_top]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['header_top'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header right.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[header_right]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['header_right'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header bottom.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[header_bottom]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['header_bottom'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header left.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[header_left]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['header_left'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[mobile_header_top]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['mobile_header_top'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header right.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[mobile_header_right]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['mobile_header_right'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header bottom.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[mobile_header_bottom]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['mobile_header_bottom'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Header left.
|
|
|
|
$wp_customize->add_setting(
|
|
|
|
'generate_spacing_settings[mobile_header_left]',
|
2020-04-07 13:03:04 +00:00
|
|
|
array(
|
2020-08-13 14:53:39 +00:00
|
|
|
'default' => $defaults['mobile_header_left'],
|
|
|
|
'type' => 'option',
|
2020-04-07 13:03:04 +00:00
|
|
|
'sanitize_callback' => 'absint',
|
2020-08-13 14:53:39 +00:00
|
|
|
'transport' => 'postMessage',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-08-13 14:53:39 +00:00
|
|
|
// Do something with our header controls.
|
2020-04-07 13:03:04 +00:00
|
|
|
$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(
|
2020-08-13 14:53:39 +00:00
|
|
|
'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]',
|
2020-04-07 13:03:04 +00:00
|
|
|
'mobile_top' => 'generate_spacing_settings[mobile_header_top]',
|
|
|
|
'mobile_right' => 'generate_spacing_settings[mobile_header_right]',
|
|
|
|
'mobile_bottom' => 'generate_spacing_settings[mobile_header_bottom]',
|
2020-08-13 14:53:39 +00:00
|
|
|
'mobile_left' => 'generate_spacing_settings[mobile_header_left]',
|
2020-04-07 13:03:04 +00:00
|
|
|
),
|
2020-08-13 14:53:39 +00:00
|
|
|
'element' => 'header',
|
2020-04-07 13:03:04 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|