Wordpress Save an Option form Customizer

你离开我真会死。 提交于 2019-12-24 07:03:57

问题


So I got this Code working, so It displays the Settings in the Wordpress Customizer. What is missing now, is that it saves it somewhere. I can not figure out how to do that. I was hoping someone could answer me this.

And since I don't know how to save it, I am not sure how I will be able to get it. with get_option() I can get things from the Database.

As far as I know, I currently only have the barebone structure, which does not provide saving or anything for my options (in the array). I am trying to follow this fairly old guide: LINK

add_action( 'customize_register', 'color_scheme_customize' );
function color_scheme_customize($wp_customize) {
$wp_customize->add_section( 'calmarstudio_color_scheme', array(
    'title'          => __( 'Color Scheme', 'calmarstudio' ),
    'priority'       => 35,
) );

$wp_customize->add_setting( 'calmarstudio_theme_options[color_scheme]', array(
    'default'        => 'some-default-value',
    'type'           => 'option',
    'capability'     => 'edit_theme_options',
) );

$wp_customize->add_control( 'calmarstudio_color_scheme', array(
    'label'      => __( 'Color Scheme', 'calmarstudio' ),
    'section'    => 'calmarstudio_color_scheme',
    'settings'   => 'calmarstudio_theme_options[color_scheme]',
    'type'       => 'radio',
    'choices'    => array(
        'blue' => 'Blue (Standard)',
        'orange' => 'Gold',
        'red' => 'Bordeaux',
        ),
) );
}

来源:https://stackoverflow.com/questions/41284542/wordpress-save-an-option-form-customizer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!