Retrieve a customize setting.
public get_setting ( string $id ) : WP_Customize_Setting | void | ||
$id | string | Customize Setting ID. |
return | WP_Customize_Setting | void | The setting, if set. |
// Get the setting object for a particular setting ID $setting = $wp_customize->get_setting('setting_id');
// Check if a particular setting is active if ( $wp_customize->get_setting('setting_id')->active() ) { // Do something if the setting is active }This code checks if the setting object for a particular setting ID is active or not. If the setting is active, then the condition inside the if statement will be executed, which can be used to modify the appearance of the theme in some way. The WP_Customize_Manager get_setting function is part of the WordPress core library and can be found within the class-wp-customize-manager.php file.
public get_setting ( string $id ) : WP_Customize_Setting | void | ||
$id | string | Customize Setting ID. |
return | WP_Customize_Setting | void | The setting, if set. |