So, I’ve got the following code:
function themename_customize_register($wp_customize){
// Display date
$wp_customize->add_section('display_date_section', array(
'title' => 'Datum weergeven',
'description' => 'Wil je de datum weergeven?',
'priority' => 120,
));
$wp_customize->add_setting('display_date', array(
'default' => 'value1',
'capability' => 'edit_theme_options',
'type' => 'option',
));
$wp_customize->add_control('display_date_section', array(
'label' => 'Datum weergeven:',
'section' => 'display_date_section',
'settings' => 'display_date',
'type' => 'theme_mod',
'choices' => array(
'value1' => 'Ja',
'value2' => 'Nee',
),
));
}
add_action('customize_register', 'themename_customize_register');
How can I access the value of the setting? Right now whenever I try to access it (either through get_theme_mod
or $wp_customize->get_settings
) My main goal with the code is to let users have the ability to control wether they want to display the date or not. Can somebody help me? 😀