我在wordpress中为Visual Composer图标框添加了新图标,但我得到以下2个错误,任何人都知道如何修复?下面是我的functions.PHP文件中的代码
// Add new custom font to Font Family selection in icon Box module
function myprefix_add_new_icon_set_to_iconBox( ) {
$param = WPBMap::getParam( 'vcex_icon_Box', 'icon_type' );
$param['value'][__( 'CUSTOM ICONS NAME', 'total' )] = 'my_custom_icons';
vc_update_shortcode_param( 'vcex_icon_Box', $param );
}
add_filter( 'init', 'myprefix_add_new_icon_set_to_iconBox', 40 );
// Add font picker setting to icon Box module when you select your font family from the dropdown
function myprefix_add_font_picker() {
vc_add_param( 'vcex_icon_Box', array(
'type' => 'iconpicker',
'heading' => esc_html__( 'Icon', 'total' ),
'param_name' => 'my_custom_icons',
'settings' => array(
'emptyIcon' => true,
'type' => 'my_custom_icons',
'iconsPerPage' => 20,
),
'dependency' => array(
'element' => 'icon_type',
'value' => 'my_custom_icons',
),
'group' => esc_html__( 'Icon', 'total' ),
)
);
}
add_filter( 'vc_after_init', 'myprefix_add_font_picker', 40 );
// Add array of your fonts so they can be displayed in the font selector
function my_icon_array() {
return array(
array(
'bg-icon-twitter' => 'Twitter',
'bg-icon-user' => 'User'
));
}
add_filter( 'vc_iconpicker-type-my_custom_icons', 'my_icon_array' );
注意:
Wrong name for shortcode:vcex_icon_Box. Name required in
/home/…/plugins/js_composer/include/classes/core/class-wpb-map.PHP
on line 472
警告:
Cannot use a scalar value as an array in
/home/…/plugins/js_composer/include/classes/core/class-wpb-map.PHP
on line 367
解决方法:
错误1是由于您的安装中没有名为“vcex_icon_Box”的短代码引起的.请尝试“vc_icon”.
此外,如果使用vc_icon,则需要将依赖项元素更改为type而不是icon_type.
对于错误2,WPBMap :: getParam(‘vcex_icon_Box’,’icon_type’);返回标量值,然后您可以将其视为数组.
作为调试提示,测试函数输出是一个好主意,这样您就可以理解所获得的内容.
VC文档也不是最好的.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。