gpt4 book ai didi

php - 在自定义视觉编辑器项目中选择类型

转载 作者:搜寻专家 更新时间:2023-10-31 21:21:09 25 4
gpt4 key购买 nike

我正在尝试为我的主题制作自定义可视化作曲器项目。到现在为止我都做对了。但在这里,我想为我的项目做出选择,以检查它是否是第一个值显示的东西,如果是第二个值显示的东西等等。但我不知道如何进行选择。这是我在映射部分的 php 文件代码:

<?php
// Element Mapping
public function vc_showcase_mapping() {

// Stop all if VC is not enabled
if ( !defined( 'WPB_VC_VERSION' ) ) {
return;
}

// Map the block with vc_map()
vc_map(
array(
'name' => __('Showcase', 'filmview'),
'base' => 'vc_showcase',
'description' => __('Showcase', 'filmview'),
'category' => __('filmview', 'filmview'),
'icon' => get_template_directory_uri().'/vc-elements/img/vc-showcase.png',
'params' => array(

array(
'type' => 'input',
'holder' => '',
'class' => '',
'heading' => __( 'Showcase type', 'filmview' ),
'param_name' => 'showcase-type',
'value' => __( 'showcase-1', 'filmview' ),
'description' => __( 'select type', 'filmview' ),
'admin_label' => false,
'weight' => 0,
'group' => 'settings',
),
),
)
);

}
?>

最佳答案

我得到了我的答案,这里有:

我只需要将 'value' => __( 'showcase-1', 'filmview' ), 更改为:

'value' => array(
array(
'value' => 'showcase-1',
'label' => __( 'showcase type 1', 'filmview' ),
),
array(
'value' => 'showcase-2',
'label' => __( 'showcase type 2', 'filmview' ),
),
)

关于php - 在自定义视觉编辑器项目中选择类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48050576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com