【发布时间】:2018-11-23 01:34:57
【问题描述】:
我正在尝试列出要在 WordPress 定制器的下拉菜单中使用的 Google 字体选择列表,但我很难正确地循环:
$i = 0;
foreach ($items as $font_value => $item) {
$i++;
$str = $item['family'];
}
上面的字符串需要在下面的数组中才能生成选择列表:
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ounox-fonts-display-control', array(
'label' => 'Fonts Section',
'section' => 'ounox-fonts-section',
'settings' => 'ounox-fonts-display',
'type' => 'select',
'choices' => $str
)));
【问题讨论】: