我对WordPress Customizer复选框的默认值有问题。
无论我在默认值中输入了什么,但该复选框始终在主题定制器中选中。
$wp_customize->add_setting( \'swastika_social_youtube\', array(
\'capability\' => \'edit_theme_options\',
\'default\' => \'false\',
\'sanitize_callback\' => \'swastika_sanitize_checkbox\',
)
);
$wp_customize->add_control( \'swastika_social_youtube\', array(
\'type\' => \'checkbox\',
\'section\' => \'social_settings_section\',
\'label\' => __( \'Show Youtube Icon\', \'swastika\' ),
)
);
下面是我如何显示图标
<?php if ( true == get_theme_mod( \'swastika_social_youtube\', false ) ) { ?>
<a href="#"><i class="fa fa-youtube-play" aria-hidden="true"></i></a>
<?php } ?>
请帮帮我