我昨天开始在Wordpress中编码,我的问题是为什么在“Nagłówek”部分只显示“Tło”?这是代码:
<?php
// Header Section
$wp_customize->add_section(\'header\', array(
\'title\' => __(\'Nagłówek\', \'Agmor Bootstrap\'),
\'description\'=> sprintf(__(\'Opcje nagłówka:\', \'Agmor Bootstrap\')),
\'priority\' => 100
));
$wp_customize -> add_setting(\'header_logo\', array(
\'default\' => get_bloginfo(\'template_directory\').\'/img/logo.png\',
\'type\' => \'theme_mod\'
));
$wp_customize -> add_control(new WP_Customize_Image_Control($wp_customize, \'Agmor Bootstrap\', array(
\'label\' => __( \'Logo\', \'Agmor Bootstrap\'),
\'section\' => \'header\',
\'settings\' => \'header_logo\',
\'priority\' => 1
)));
$wp_customize -> add_setting(\'header_background\', array(
\'default\' => get_bloginfo(\'template_directory\').\'/img/bg-header.png\',
\'type\' => \'theme_mod\'
));
$wp_customize -> add_control(new WP_Customize_Image_Control($wp_customize, \'Agmor Bootstrap\', array(
\'label\' => __( \'Tło\', \'Agmor Bootstrap\'),
\'section\' => \'header\',
\'settings\' => \'header_background\',
\'priority\' => 2
)));
最合适的回答,由SO网友:Jacob Peattie 整理而成
的第二个参数WP_Customize_Image_Control
是控件的ID。您为两个图像控件指定了相同的id,\'Agmor Bootstrap\'
.
给他们唯一的ID,两者都应该出现。使用设置名称是一个简单的选项:
new WP_Customize_Image_Control($wp_customize, \'header_logo\', array(
new WP_Customize_Image_Control($wp_customize, \'header_background\', array(