如果可以的话,我会发表评论。如果您的主题变体仅包含样式修改,您可以添加变体样式表@inc/css/,然后这里是一个引用示例,使其全部正确。
@\\选项\\选项核心。php:
$fields_list[] = array(
\'name\' => __(\'Select a Skin Color\', \'mytheme\'),
\'id\' => \'mytheme_skin_color\',
\'std\' => \'default\',
\'type\' => \'images\',
\'options\' => apply_filters( \'mytheme_skin_color\', array(
\'default\' => $directory_uri . \'/inc/css/skins/images/default.png\'
) )
@ \\选项\\选项自定义程序。php:
/********** Class for skin color selection option starts *************/
class mytheme_skin_selector extends WP_Customize_Control {
public $type = \'radio\';
images-skin-subcontainer {
display: inline;
}
.images-skin-subcontainer img {
margin-top: 5px;
}
.images-skin-subcontainer img.of-radio-img-selected {
border: 5px solid #5DA7F2;
}
.images-skin-subcontainer img:hover {
cursor: pointer;
//if get mytheme mod background image has a value then we need to set default bg to none
$test_skin = $this->value();
$name = \'_customize-radio-\' . $this->id;
$selected = ( $test_skin == $value ) ? \'of-radio-img-selected\' : \'\';
?>
" name="" link(); checked( $test_skin, $value style="display:none;" />
" class="of-radio-img-img " /
}
/********** Class for skin color selection option ends *************/
// mytheme skin
$wp_customize->add_setting( \'mytheme_options[mytheme_skin_color]\', array(
\'default\' => \'default\',
$wp_customize -> add_control( new mytheme_skin_selector( $wp_customize, \'skin_color\', array(
\'label\' => __( \'Skin Color\', \'mytheme\' ),
\'section\' => \'mytheme_design_section\',
\'settings\' => \'mytheme_options[mytheme_skin_color]\',
\'choices\' => apply_filters( \'mytheme_skin_color\', \'\' ),
) ) );
希望这对双方都有帮助。