laipower/wp-content/plugins/gp-premium/spacing/functions/customizer/header-spacing.php

136 lines
3.4 KiB
PHP
Raw Permalink Normal View History

2020-04-07 13:03:04 +00:00
<?php
/**
* This file handles the header spacing Customizer options.
*
* @package GP Premium
*/
2020-04-07 13:03:04 +00:00
if ( ! defined( 'ABSPATH' ) ) {
exit; // No direct access, please.
2020-04-07 13:03:04 +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,
'panel' => 'generate_spacing_panel',
2020-04-07 13:03:04 +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';
// Header top.
$wp_customize->add_setting(
'generate_spacing_settings[header_top]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['header_top'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
// Header right.
$wp_customize->add_setting(
'generate_spacing_settings[header_right]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['header_right'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
// Header bottom.
$wp_customize->add_setting(
'generate_spacing_settings[header_bottom]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['header_bottom'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
// Header left.
$wp_customize->add_setting(
'generate_spacing_settings[header_left]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['header_left'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_top]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['mobile_header_top'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
// Header right.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_right]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['mobile_header_right'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
// Header bottom.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_bottom]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['mobile_header_bottom'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +00:00
)
);
// Header left.
$wp_customize->add_setting(
'generate_spacing_settings[mobile_header_left]',
2020-04-07 13:03:04 +00:00
array(
'default' => $defaults['mobile_header_left'],
'type' => 'option',
2020-04-07 13:03:04 +00:00
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
2020-04-07 13:03:04 +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(
'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]',
'mobile_left' => 'generate_spacing_settings[mobile_header_left]',
2020-04-07 13:03:04 +00:00
),
'element' => 'header',
2020-04-07 13:03:04 +00:00
)
)
);