this is my code:
function vds_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';
$wp_customize->add_section( 'blog_settings' , array(
'title' => __( 'Blog settings', 'vds' ),
'priority' => 30
) );
$wp_customize->add_setting( 'vds[blog_show_commentslink_in_overview]', array(
'default' => '1',
'type' => 'option'
) );
$wp_customize->add_control( 'blog_show_commentslink_in_overview', array(
'label' => __( 'Show comments link in blog overview?' ),
'section' => 'blog_settings',
'settings' => 'vds[blog_show_commentslink_in_overview]',
'type' => 'checkbox',
'std' => '1'
) );
}
add_action( 'customize_register', 'vds_customize_register' );
I tried the following code to get the value in the templates:
get_option( 'vds[blog_show_commentslink_in_overview]' );
get_option( 'blog_show_commentslink_in_overview' );
get_theme_mod( 'vds[blog_show_commentslink_in_overview]' );
get_theme_mod( 'blog_show_commentslink_in_overview' );
none of them worked :/ Why is that? The actual value is stored I guess because if I deactivate the checkbox in the customizer and reload the customizer, the checkbox is unchecked so it shouldve saved that.
Aucun commentaire:
Enregistrer un commentaire