| Server IP : 151.101.66.159 / Your IP : 216.73.216.66 Web Server : Flywheel/5.1.0 System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64 User : root ( ) PHP Version : 7.4.33.18 Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wp-content/themes/twentynineteen/inc/ |
Upload File : |
<?php
/**
* Twenty Nineteen: Customizer
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since Twenty Nineteen 1.0
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function twentynineteen_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title a',
'render_callback' => 'twentynineteen_customize_partial_blogname',
)
);
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'render_callback' => 'twentynineteen_customize_partial_blogdescription',
)
);
}
/**
* Primary color.
*/
$wp_customize->add_setting(
'primary_color',
array(
'default' => 'default',
'transport' => 'postMessage',
'sanitize_callback' => 'twentynineteen_sanitize_color_option',
)
);
$wp_customize->add_control(
'primary_color',
array(
'type' => 'radio',
'label' => __( 'Primary Color', 'twentynineteen' ),
'choices' => array(
'default' => _x( 'Default', 'primary color', 'twentynineteen' ),
'custom' => _x( 'Custom', 'primary color', 'twentynineteen' ),
),
'section' => 'colors',
'priority' => 5,
)
);
// Add primary color hue setting and control.
$wp_customize->add_setting(
'primary_color_hue',
array(
'default' => 199,
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'primary_color_hue',
array(
'description' => __( 'Apply a custom color for buttons, links, featured images, etc.', 'twentynineteen' ),
'section' => 'colors',
'mode' => 'hue',
)
)
);
// Add image filter setting and control.
$wp_customize->add_setting(
'image_filter',
array(
'default' => 1,
'sanitize_callback' => 'absint',
'transport' => 'postMessage',
)
);
$wp_customize->add_control(
'image_filter',
array(
'label' => __( 'Apply a filter to featured images using the primary color', 'twentynineteen' ),
'section' => 'colors',
'type' => 'checkbox',
)
);
}
add_action( 'customize_register', 'twentynineteen_customize_register' );
/**
* Render the site title for the selective refresh partial.
*
* @return void
*/
function twentynineteen_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
*
* @return void
*/
function twentynineteen_customize_partial_blogdescription() {
bloginfo( 'description' );
}
/**
* Bind JS handlers to instantly live-preview changes.
*/
function twentynineteen_customize_preview_js() {
wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', true );
}
add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
/**
* Load dynamic logic for the customizer controls area.
*/
function twentynineteen_panels_js() {
wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', true );
}
add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );
/**
* Sanitize custom color choice.
*
* @param string $choice Whether image filter is active.
*
* @return string
*/
function twentynineteen_sanitize_color_option( $choice ) {
$valid = array(
'default',
'custom',
);
if ( in_array( $choice, $valid, true ) ) {
return $choice;
}
return 'default';
}