【发布时间】:2019-07-25 04:20:49
【问题描述】:
我正在创建一个自定义 Gravity Forms 插件,目前看来它可以正常工作。设置按预期显示和保存。
这是我所拥有的:
public function plugin_settings_fields() {
return array(
array(
'title' => esc_html__( 'Animal Types', 'animaltypes' ),
'fields' => array(
array(
'name' => 'gravity_forms_animal_types',
'type' => 'checkbox',
'label' => esc_html__( 'Animal Types', 'animaltypes' ),
'choices' => array(
array(
'label' => esc_html__( 'Cat', 'animaltypes' ),
'name' => 'option_cat',
'default_value' => 0,
),
array(
'label' => esc_html__( 'Dogs', 'animaltypes' ),
'name' => 'option_dog',
'default_value' => 0,
)
)
),
)
)
);
}
但我不知道如何检查,例如,是否设置了option_cat,以便我可以运行自定义函数。
所以基本上(我知道下面的代码不正确)是这样的:
if(option_cat == true) {
my_cat_function();
}
【问题讨论】:
标签: php wordpress if-statement gravity-forms-plugin