PHP in array equal/not equal -
im working on wordpress website , have problems arrays.
here code:
'text' => array( 'type' => 'text', 'title' => __('subtitle', 'wpml'), 'description' => __('enter subtitle text or leave empty hide.', 'wpml'), 'condition' => array('type', '==', 'something1') ),
how can put multiple items condition
?
i need 3 items (something1,something5,something8) equal condition.
edit: part of plugin in backend, have options elements allowed enter description , not.
here full class:
function shortcode_options_fields() { $this->shortcode_options = array( 'type' => array( 'type' => 'select', 'title' => __('type', 'wpml'), 'description' => __('select services type.', 'wpml'), 'options' => array( 'service1' => __('service 1', 'wpml'), 'service2' => __('service 2', 'wpml'), 'service3' => __('service 3', 'wpml'), 'service4' => __('service 4', 'wpml'), 'service5' => __('service 5', 'wpml'), 'service6' => __('service 6', 'wpml'), 'service7' => __('service 7', 'wpml'), 'service8' => __('service 8', 'wpml'), 'service9' => __('service 9', 'wpml'), ), 'default' => 'service1' ), 'text' => array( 'type' => 'text', 'title' => __('title', 'wpml'), 'description' => __('service title.', 'wpml') ), 'subtitle' => array( 'type' => 'text', 'title' => __('subtitle', 'wpml'), 'description' => __('enter subtitle text or leave empty hide.', 'wpml'), 'condition' => array() ), 'description' => array( 'type' => 'textarea', 'title' => __('description', 'wpml'), 'description' => __('service description.', 'wpml'), 'condition' => array('type', '==', 'service1') ), ); }
only service 1,5 , 8 shuld have description nothing else.
i hope make more clear, thanks
you can find more details on documentation wordpres: https://codex.wordpress.org/
but believe looking like:
'text' => array( 'type' => 'text', 'title' => __('subtitle', 'wpml'), 'description' => __('enter subtitle text or leave empty hide.', 'wpml'), 'condition' => array('type', '==', ('something1', 'something2', 'something3')) ),
Comments
Post a Comment