get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
$wp_customize->get_setting('header_textcolor')->transport = 'postMessage';
/* SECTION: Structure */
$wp_customize->add_section('ltkf-section-structure', [
'title' => __('Page layout', 'ltk-foundation'),
'description' => __('Settings that affect how elements are organized within the website.', 'ltk-foundation'),
'priority' => 90
]);
/* SETTING: Structure > Layout */
$wp_customize->add_setting('ltkf-setting-layout', [
'default' => 'container',
'sanitize_callback' => 'LTK\Foundation\Customize\Customizer::sanitizeSettingLayout'
]);
$wp_customize->add_control('ltkf-setting-layout', [
'type' => 'select',
'label' => __('Layout mode', 'ltk-foundation'),
'section' => 'ltkf-section-structure',
'choices' => [
'container' => __('Inside a container', 'ltk-foundation'),
'full-width' => __('Full width', 'ltk-foundation')
],
]);
}
/**
* Sanitize layout setting
*
* Possible values are 'container' and 'full-width', if other is sent, this
* function will just return 'container' instead.
*
* @param string $input Value of the layout setting
*
* @return string Sanitized value
*/
static public function sanitizeSettingLayout($input) {
if (! in_array($input, ['container', 'full-width'])) {
return 'container';
}
return $input;
}
/**
* Inserts scripts into theme customizer to allow instant modification
*/
static public function registerPreview() {
wp_enqueue_script('theme-customizer',
get_parent_theme_file_uri() . '/assets/js/theme-customizer.min.js',
['jquery', 'customize-preview'], '', true
);
}
/**
* WordPress default settings: header, logo, colors...
*/
static public function defaultSettings() {
$header_image = get_theme_mod('header_image', false);
if ($header_image && $header_image != 'remove-header') { ?>