Skip to content

Commit d889866

Browse files
committed
Add term data and callback to select in sample config. Add 'global_variable' entry.
Signed-off-by: Kevin Provance <[email protected]>
1 parent 6fa7168 commit d889866

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

sample/sample-config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
'admin_bar_priority' => 50,
106106

107107
// Sets a different name for your global variable other than the opt_name.
108-
'global_variable' => '',
108+
'global_variable' => $opt_name,
109109

110110
// Show the time the page took to load, etc. (forced on while on localhost or when WP_DEBUG is enabled).
111111
'dev_mode' => true,

sample/sections/select-fields/select.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,23 @@
139139
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
140140
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
141141
),
142+
array(
143+
'id' => 'opt-select-terms',
144+
'type' => 'select',
145+
'data' => 'terms',
146+
'title' => esc_html__( 'Terms Select Option', 'your-textdomain-here' ),
147+
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
148+
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
149+
),
150+
array(
151+
'id' => 'opt-multi-select-terms',
152+
'type' => 'select',
153+
'data' => 'terms',
154+
'multi' => true,
155+
'title' => esc_html__( 'Terms Multi Select Option', 'your-textdomain-here' ),
156+
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
157+
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
158+
),
142159
array(
143160
'id' => 'opt-select-menus',
144161
'type' => 'select',
@@ -237,6 +254,31 @@
237254
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
238255
'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ),
239256
),
257+
array(
258+
'id' => 'opt-select-callback',
259+
'type' => 'select',
260+
'data' => 'callback',
261+
'args' => 'redux_select_callback',
262+
'title' => esc_html__( 'Select Option using a Callback', 'your-textdomain-here' ),
263+
'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ),
264+
'desc' => esc_html__( 'The items in this selcect were added via a callback function.', 'your-textdomain-here' ),
265+
),
240266
),
241267
)
242268
);
269+
270+
/**
271+
* Select callback function.
272+
*
273+
* @return array
274+
*/
275+
function redux_select_callback(): array {
276+
$options = array();
277+
278+
$options[0] = esc_html__( 'Zero', 'your-textdomain-here' );
279+
$options[1] = esc_html__( 'One', 'your-textdomain-here' );
280+
$options[2] = esc_html__( 'Two', 'your-textdomain-here' );
281+
$options[3] = esc_html__( 'Three', 'your-textdomain-here' );
282+
283+
return $options;
284+
}

0 commit comments

Comments
 (0)