Skip to content

Instantly share code, notes, and snippets.

@lots0logs
Created April 21, 2018 20:06
Show Gist options
  • Save lots0logs/be43238af291ddcebfcf424211edd8fb to your computer and use it in GitHub Desktop.
Save lots0logs/be43238af291ddcebfcf424211edd8fb to your computer and use it in GitHub Desktop.
Module Settings Field Visibility Example 3
<?php
...
public function get_fields() {
return array(
'setting_a' => array(
'label' => esc_html__( 'Setting A', 'myex-my-extension' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => esc_html__( 'Input something here.', 'myex-my-extension' ),
'toggle_slug' => 'main_content',
'show_if' => array(
'setting_b' => array( 'value_1', 'value_3', 'value_4' ),
),
'show_if_not' => array(
'setting_c' => 'some_value',
'setting_d' => array( 'value_1', 'value_4' ),
),
),
'setting_b' => array(
...
),
'setting_c' => array(
...
),
'setting_d' => array(
...
),
);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment