Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Here is the code I'm using to add the section to the Customize panel.

function apple_customize_register($wp_customize){
$wp_customize->add_section('apple_footer', array(
    'title'    => 'Footer',
    'priority' => 120,
));
//------ display copyright in footer
$wp_customize->add_setting('theme_options[copyright]', array(
    'capability' => 'edit_theme_options',
    'type'       => 'option',
));
$wp_customize->add_control('theme_options[copyright]', array(
    'settings' => 'theme_options[copyright]',
    'label'    => __('Display Copyright'),
    'section'  => 'apple_footer',
    'type'     => 'checkbox',
    'value' => '1'
));
}
add_action('customize_register', 'apple_customize_register');

How do I use the values in my theme. I have tryed get_option('theme_options[copyright]'), get_theme_mod('theme_options[copyright]') and many more, but all var_dump out bool(false). Please tell me what I'm missing.

share|improve this question
add comment

1 Answer 1

$wp_customize->add_setting('theme_options[copyright]', array(
'default'    => '1',
'capability' => 'edit_theme_options',
'type'       => 'option',
));

There is nothing wrong except the default value (missing). You cant use your setting till you store it a value.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.