balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

sample-config.php (25688B)


      1 <?php
      2 /**
      3  * ReduxFramework Sample Config File
      4  * For full documentation, please visit: http://devs.redux.io/
      5  *
      6  * @package Redux Framework
      7  */
      8 
      9 defined( 'ABSPATH' ) || exit;
     10 
     11 if ( ! class_exists( 'Redux' ) ) {
     12 	return;
     13 }
     14 
     15 // This is your option name where all the Redux data is stored.
     16 $opt_name = 'redux_demo';  // YOU MUST CHANGE THIS.  DO NOT USE 'redux_demo' IN YOUR PROJECT!!!
     17 
     18 // Uncomment to disable demo mode.
     19 /* Redux::disable_demo(); */  // phpcs:ignore Squiz.PHP.CommentedOutCode
     20 
     21 $dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
     22 
     23 /*
     24  * --> Used within different fields. Simply examples. Search for ACTUAL DECLARATION for field examples
     25  */
     26 
     27 // Background Patterns Reader.
     28 $sample_patterns_path = Redux_Core::$dir . '../sample/patterns/';
     29 $sample_patterns_url  = Redux_Core::$url . '../sample/patterns/';
     30 $sample_patterns      = array();
     31 
     32 if ( is_dir( $sample_patterns_path ) ) {
     33 	$sample_patterns_dir = opendir( $sample_patterns_path );
     34 
     35 	if ( $sample_patterns_dir ) {
     36 		$sample_patterns = array();
     37 
     38 		// phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition
     39 		while ( false !== ( $sample_patterns_file = readdir( $sample_patterns_dir ) ) ) {
     40 			if ( stristr( $sample_patterns_file, '.png' ) !== false || stristr( $sample_patterns_file, '.jpg' ) !== false ) {
     41 				$name              = explode( '.', $sample_patterns_file );
     42 				$name              = str_replace( '.' . end( $name ), '', $sample_patterns_file );
     43 				$sample_patterns[] = array(
     44 					'alt' => $name,
     45 					'img' => $sample_patterns_url . $sample_patterns_file,
     46 				);
     47 			}
     48 		}
     49 	}
     50 }
     51 
     52 // Used to execept HTML tags in description arguments where esc_html would remove.
     53 $kses_exceptions = array(
     54 	'a'      => array(
     55 		'href' => array(),
     56 	),
     57 	'strong' => array(),
     58 	'br'     => array(),
     59 	'code'   => array(),
     60 );
     61 
     62 /*
     63  * ---> BEGIN ARGUMENTS
     64  */
     65 
     66 /**
     67  * All the possible arguments for Redux.
     68  * For full documentation on arguments, please refer to: https://devs.redux.io/core/arguments/
     69  */
     70 $theme = wp_get_theme(); // For use with some settings. Not necessary.
     71 
     72 // TYPICAL -> Change these values as you need/desire.
     73 $args = array(
     74 	// This is where your data is stored in the database and also becomes your global variable name.
     75 	'opt_name'                  => $opt_name,
     76 
     77 	// Name that appears at the top of your panel.
     78 	'display_name'              => $theme->get( 'Name' ),
     79 
     80 	// Version that appears at the top of your panel.
     81 	'display_version'           => $theme->get( 'Version' ),
     82 
     83 	// Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only).
     84 	'menu_type'                 => 'menu',
     85 
     86 	// Show the sections below the admin menu item or not.
     87 	'allow_sub_menu'            => true,
     88 
     89 	// The text to appear in the admin menu.
     90 	'menu_title'                => esc_html__( 'Sample Options', 'your-textdomain-here' ),
     91 
     92 	// The text to appear on the page title.
     93 	'page_title'                => esc_html__( 'Sample Options', 'your-textdomain-here' ),
     94 
     95 	// Disable to create your own Google fonts loader.
     96 	'disable_google_fonts_link' => false,
     97 
     98 	// Show the panel pages on the admin bar.
     99 	'admin_bar'                 => true,
    100 
    101 	// Icon for the admin bar menu.
    102 	'admin_bar_icon'            => 'dashicons-portfolio',
    103 
    104 	// Priority for the admin bar menu.
    105 	'admin_bar_priority'        => 50,
    106 
    107 	// Sets a different name for your global variable other than the opt_name.
    108 	'global_variable'           => $opt_name,
    109 
    110 	// Show the time the page took to load, etc. (forced on while on localhost or when WP_DEBUG is enabled).
    111 	'dev_mode'                  => true,
    112 
    113 	// Enable basic customizer support.
    114 	'customizer'                => true,
    115 
    116 	// Allow the panel to open expanded.
    117 	'open_expanded'             => false,
    118 
    119 	// Disable the save warning when a user changes a field.
    120 	'disable_save_warn'         => false,
    121 
    122 	// Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
    123 	'page_priority'             => null,
    124 
    125 	// For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters.
    126 	'page_parent'               => 'themes.php',
    127 
    128 	// Permissions needed to access the options panel.
    129 	'page_permissions'          => 'manage_options',
    130 
    131 	// Specify a custom URL to an icon.
    132 	'menu_icon'                 => '',
    133 
    134 	// Force your panel to always open to a specific tab (by id).
    135 	'last_tab'                  => '',
    136 
    137 	// Icon displayed in the admin panel next to your menu_title.
    138 	'page_icon'                 => 'icon-themes',
    139 
    140 	// Page slug used to denote the panel, will be based off page title, then menu title, then opt_name if not provided.
    141 	'page_slug'                 => $opt_name,
    142 
    143 	// On load save the defaults to DB before user clicks save.
    144 	'save_defaults'             => true,
    145 
    146 	// Display the default value next to each field when not set to the default value.
    147 	'default_show'              => false,
    148 
    149 	// What to print by the field's title if the value shown is default.
    150 	'default_mark'              => '*',
    151 
    152 	// Shows the Import/Export panel when not used as a field.
    153 	'show_import_export'        => true,
    154 
    155 	// The time transinets will expire when the 'database' arg is set.
    156 	'transient_time'            => 60 * MINUTE_IN_SECONDS,
    157 
    158 	// Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output.
    159 	'output'                    => true,
    160 
    161 	// Allows dynamic CSS to be generated for customizer and google fonts,
    162 	// but stops the dynamic CSS from going to the page head.
    163 	'output_tag'                => true,
    164 
    165 	// Disable the footer credit of Redux. Please leave if you can help it.
    166 	'footer_credit'             => '',
    167 
    168 	// If you prefer not to use the CDN for ACE Editor.
    169 	// You may download the Redux Vendor Support plugin to run locally or embed it in your code.
    170 	'use_cdn'                   => true,
    171 
    172 	// Set the theme of the option panel.  Use 'wp' to use a more modern style, default is classic.
    173 	'admin_theme'               => 'wp',
    174 
    175 	// Enable or disable flyout menus when hovering over a menu with submenus.
    176 	'flyout_submenus'           => true,
    177 
    178 	// Mode to display fonts (auto|block|swap|fallback|optional)
    179 	// See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display.
    180 	'font_display'              => 'swap',
    181 
    182 	// HINTS.
    183 	'hints'                     => array(
    184 		'icon'          => 'el el-question-sign',
    185 		'icon_position' => 'right',
    186 		'icon_color'    => 'lightgray',
    187 		'icon_size'     => 'normal',
    188 		'tip_style'     => array(
    189 			'color'   => 'red',
    190 			'shadow'  => true,
    191 			'rounded' => false,
    192 			'style'   => '',
    193 		),
    194 		'tip_position'  => array(
    195 			'my' => 'top left',
    196 			'at' => 'bottom right',
    197 		),
    198 		'tip_effect'    => array(
    199 			'show' => array(
    200 				'effect'   => 'slide',
    201 				'duration' => '500',
    202 				'event'    => 'mouseover',
    203 			),
    204 			'hide' => array(
    205 				'effect'   => 'slide',
    206 				'duration' => '500',
    207 				'event'    => 'click mouseleave',
    208 			),
    209 		),
    210 	),
    211 
    212 	// FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.
    213 	// possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
    214 	'database'                  => '',
    215 	'network_admin'             => true,
    216 );
    217 
    218 
    219 // ADMIN BAR LINKS -> Setup custom links in the admin bar menu as external items.
    220 // PLEASE CHANGE THEME BEFORE RELEASEING YOUR PRODUCT!!
    221 // If these are left unchanged, they will not display in your panel!
    222 $args['admin_bar_links'][] = array(
    223 	'id'    => 'redux-docs',
    224 	'href'  => '//devs.redux.io/',
    225 	'title' => __( 'Documentation', 'your-textdomain-here' ),
    226 );
    227 
    228 $args['admin_bar_links'][] = array(
    229 	'id'    => 'redux-support',
    230 	'href'  => '//github.com/ReduxFramework/redux-framework/issues',
    231 	'title' => __( 'Support', 'your-textdomain-here' ),
    232 );
    233 
    234 $args['admin_bar_links'][] = array(
    235 	'id'    => 'redux-extensions',
    236 	'href'  => 'redux.io/extensions',
    237 	'title' => __( 'Extensions', 'your-textdomain-here' ),
    238 );
    239 
    240 // SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.
    241 // PLEASE CHANGE THEME BEFORE RELEASEING YOUR PRODUCT!!
    242 // If these are left unchanged, they will not display in your panel!
    243 $args['share_icons'][] = array(
    244 	'url'   => '//github.com/ReduxFramework/ReduxFramework',
    245 	'title' => 'Visit us on GitHub',
    246 	'icon'  => 'el el-github',
    247 );
    248 $args['share_icons'][] = array(
    249 	'url'   => '//www.facebook.com/pages/Redux-Framework/243141545850368',
    250 	'title' => 'Like us on Facebook',
    251 	'icon'  => 'el el-facebook',
    252 );
    253 $args['share_icons'][] = array(
    254 	'url'   => '//twitter.com/reduxframework',
    255 	'title' => 'Follow us on Twitter',
    256 	'icon'  => 'el el-twitter',
    257 );
    258 $args['share_icons'][] = array(
    259 	'url'   => '//www.linkedin.com/company/redux-framework',
    260 	'title' => 'Find us on LinkedIn',
    261 	'icon'  => 'el el-linkedin',
    262 );
    263 
    264 // Panel Intro text -> before the form.
    265 if ( ! isset( $args['global_variable'] ) || false !== $args['global_variable'] ) {
    266 	if ( ! empty( $args['global_variable'] ) ) {
    267 		$v = $args['global_variable'];
    268 	} else {
    269 		$v = str_replace( '-', '_', $args['opt_name'] );
    270 	}
    271 
    272 	// translators:  Panel opt_name.
    273 	$args['intro_text'] = '<p>' . sprintf( esc_html__( 'Did you know that Redux sets a global variable for you? To access any of your saved options from within your code you can use your global variable: $%1$s', 'your-textdomain-here' ), '<strong>' . $v . '</strong>' ) . '<p>';
    274 } else {
    275 	$args['intro_text'] = '<p>' . esc_html__( 'This text is displayed above the options panel. It isn\'t required, but more info is always better! The intro_text field accepts all HTML.', 'your-textdomain-here' ) . '</p>';
    276 }
    277 
    278 // Add content after the form.
    279 $args['footer_text'] = '<p>' . esc_html__( 'This text is displayed below the options panel. It isn\'t required, but more info is always better! The footer_text field accepts all HTML.', 'your-textdomain-here' ) . '</p>';
    280 
    281 Redux::set_args( $opt_name, $args );
    282 
    283 /*
    284  * ---> END ARGUMENTS
    285  */
    286 
    287 /*
    288  * ---> START HELP TABS
    289  */
    290 $help_tabs = array(
    291 	array(
    292 		'id'      => 'redux-help-tab-1',
    293 		'title'   => esc_html__( 'Theme Information 1', 'your-textdomain-here' ),
    294 		'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>',
    295 	),
    296 	array(
    297 		'id'      => 'redux-help-tab-2',
    298 		'title'   => esc_html__( 'Theme Information 2', 'your-textdomain-here' ),
    299 		'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>',
    300 	),
    301 );
    302 Redux::set_help_tab( $opt_name, $help_tabs );
    303 
    304 // Set the help sidebar.
    305 $content = '<p>' . esc_html__( 'This is the sidebar content, HTML is allowed.', 'your-textdomain-here' ) . '</p>';
    306 
    307 Redux::set_help_sidebar( $opt_name, $content );
    308 
    309 /*
    310  * <--- END HELP TABS
    311  */
    312 
    313 /*
    314  * ---> START SECTIONS
    315  */
    316 
    317 // -> START Basic Fields
    318 Redux::set_section(
    319 	$opt_name,
    320 	array(
    321 		'title'            => esc_html__( 'Basic Fields', 'your-textdomain-here' ),
    322 		'id'               => 'basic',
    323 		'desc'             => esc_html__( 'These are really basic fields!', 'your-textdomain-here' ),
    324 		'customizer_width' => '400px',
    325 		'icon'             => 'el el-home',
    326 	)
    327 );
    328 
    329 require_once Redux_Core::$dir . '../sample/sections/basic-fields/checkbox.php';
    330 require_once Redux_Core::$dir . '../sample/sections/basic-fields/radio.php';
    331 require_once Redux_Core::$dir . '../sample/sections/basic-fields/sortable.php';
    332 require_once Redux_Core::$dir . '../sample/sections/basic-fields/text.php';
    333 require_once Redux_Core::$dir . '../sample/sections/basic-fields/multi-text.php';
    334 require_once Redux_Core::$dir . '../sample/sections/basic-fields/password.php';
    335 require_once Redux_Core::$dir . '../sample/sections/basic-fields/textarea.php';
    336 
    337 // -> START Editors.
    338 Redux::set_section(
    339 	$opt_name,
    340 	array(
    341 		'title'            => esc_html__( 'Editors', 'your-textdomain-here' ),
    342 		'id'               => 'editor',
    343 		'customizer_width' => '500px',
    344 		'icon'             => 'el el-edit',
    345 	)
    346 );
    347 
    348 require_once Redux_Core::$dir . '../sample/sections/editors/wordpress-editor.php';
    349 require_once Redux_Core::$dir . '../sample/sections/editors/ace-editor.php';
    350 
    351 // -> START Color Selection.
    352 Redux::set_section(
    353 	$opt_name,
    354 	array(
    355 		'title' => esc_html__( 'Color Selection', 'your-textdomain-here' ),
    356 		'id'    => 'color',
    357 		'icon'  => 'el el-brush',
    358 	)
    359 );
    360 
    361 require_once Redux_Core::$dir . '../sample/sections/color-selection/color.php';
    362 require_once Redux_Core::$dir . '../sample/sections/color-selection/color-gradient.php';
    363 require_once Redux_Core::$dir . '../sample/sections/color-selection/color-rgba.php';
    364 require_once Redux_Core::$dir . '../sample/sections/color-selection/link-color.php';
    365 require_once Redux_Core::$dir . '../sample/sections/color-selection/palette.php';
    366 require_once Redux_Core::$dir . '../sample/sections/color-selection/color-palette.php';
    367 
    368 // -> START Design Fields.
    369 Redux::set_section(
    370 	$opt_name,
    371 	array(
    372 		'title' => esc_html__( 'Design Fields', 'your-textdomain-here' ),
    373 		'id'    => 'design',
    374 		'icon'  => 'el el-wrench',
    375 	)
    376 );
    377 
    378 require_once Redux_Core::$dir . '../sample/sections/design-fields/background.php';
    379 require_once Redux_Core::$dir . '../sample/sections/design-fields/box-shadow.php';
    380 require_once Redux_Core::$dir . '../sample/sections/design-fields/border.php';
    381 require_once Redux_Core::$dir . '../sample/sections/design-fields/dimensions.php';
    382 require_once Redux_Core::$dir . '../sample/sections/design-fields/spacing.php';
    383 
    384 // -> START Media Uploads.
    385 Redux::set_section(
    386 	$opt_name,
    387 	array(
    388 		'title' => esc_html__( 'Media Uploads', 'your-textdomain-here' ),
    389 		'id'    => 'media',
    390 		'icon'  => 'el el-picture',
    391 	)
    392 );
    393 
    394 require_once Redux_Core::$dir . '../sample/sections/media-uploads/gallery.php';
    395 require_once Redux_Core::$dir . '../sample/sections/media-uploads/media.php';
    396 require_once Redux_Core::$dir . '../sample/sections/media-uploads/slides.php';
    397 
    398 // -> START Presentation Fields.
    399 Redux::set_section(
    400 	$opt_name,
    401 	array(
    402 		'title' => esc_html__( 'Presentation Fields', 'your-textdomain-here' ),
    403 		'id'    => 'presentation',
    404 		'icon'  => 'el el-screen',
    405 	)
    406 );
    407 
    408 require_once Redux_Core::$dir . '../sample/sections/presentation-fields/divide.php';
    409 require_once Redux_Core::$dir . '../sample/sections/presentation-fields/info.php';
    410 require_once Redux_Core::$dir . '../sample/sections/presentation-fields/section.php';
    411 
    412 Redux::set_section(
    413 	$opt_name,
    414 	array(
    415 		'id'   => 'presentation-divide-sample',
    416 		'type' => 'divide',
    417 	)
    418 );
    419 
    420 // -> START Switch & Button Set.
    421 Redux::set_section(
    422 	$opt_name,
    423 	array(
    424 		'title' => esc_html__( 'Switch / Button Set', 'your-textdomain-here' ),
    425 		'id'    => 'switch_buttonset',
    426 		'icon'  => 'el el-cogs',
    427 	)
    428 );
    429 
    430 require_once Redux_Core::$dir . '../sample/sections/switch-button/button-set.php';
    431 require_once Redux_Core::$dir . '../sample/sections/switch-button/switch.php';
    432 
    433 // -> START Select Fields.
    434 Redux::set_section(
    435 	$opt_name,
    436 	array(
    437 		'title' => esc_html__( 'Select Fields', 'your-textdomain-here' ),
    438 		'id'    => 'select',
    439 		'icon'  => 'el el-list-alt',
    440 	)
    441 );
    442 
    443 require_once Redux_Core::$dir . '../sample/sections/select-fields/select.php';
    444 require_once Redux_Core::$dir . '../sample/sections/select-fields/image-select.php';
    445 require_once Redux_Core::$dir . '../sample/sections/select-fields/select-image.php';
    446 
    447 // -> START Slider / Spinner.
    448 Redux::set_section(
    449 	$opt_name,
    450 	array(
    451 		'title' => esc_html__( 'Slider / Spinner', 'your-textdomain-here' ),
    452 		'id'    => 'slider_spinner',
    453 		'icon'  => 'el el-adjust-alt',
    454 	)
    455 );
    456 
    457 require_once Redux_Core::$dir . '../sample/sections/slider-spinner/slider.php';
    458 require_once Redux_Core::$dir . '../sample/sections/slider-spinner/spinner.php';
    459 
    460 // -> START Typography.
    461 require_once Redux_Core::$dir . '../sample/sections/typography/typography.php';
    462 
    463 // -> START Additional Types.
    464 Redux::set_section(
    465 	$opt_name,
    466 	array(
    467 		'title' => esc_html__( 'Additional Types', 'your-textdomain-here' ),
    468 		'id'    => 'additional',
    469 		'icon'  => 'el el-magic',
    470 	)
    471 );
    472 
    473 require_once Redux_Core::$dir . '../sample/sections/additional-types/date.php';
    474 require_once Redux_Core::$dir . '../sample/sections/additional-types/sorter.php';
    475 require_once Redux_Core::$dir . '../sample/sections/additional-types/raw.php';
    476 
    477 Redux::set_section(
    478 	$opt_name,
    479 	array(
    480 		'title' => esc_html__( 'Advanced Features', 'your-textdomain-here' ),
    481 		'icon'  => 'el el-thumbs-up',
    482 	)
    483 );
    484 
    485 require_once Redux_Core::$dir . '../sample/sections/advanced-features/callback.php';
    486 
    487 // -> START Validation.
    488 require_once Redux_Core::$dir . '../sample/sections/advanced-features/field-validation.php';
    489 
    490 // -> START Sanitizing.
    491 require_once Redux_Core::$dir . '../sample/sections/advanced-features/field-sanitizing.php';
    492 
    493 // -> START Required.
    494 require_once Redux_Core::$dir . '../sample/sections/advanced-features/field-required-linking.php';
    495 
    496 require_once Redux_Core::$dir . '../sample/sections/advanced-features/wpml-integration.php';
    497 
    498 // -> START Disabling.
    499 Redux::set_section(
    500 	$opt_name,
    501 	array(
    502 		'title' => esc_html__( 'Disabling', 'your-textdomain-here' ),
    503 		'icon'  => 'el el-lock',
    504 	)
    505 );
    506 
    507 require_once Redux_Core::$dir . '../sample/sections/disabling/disable-field.php';
    508 require_once Redux_Core::$dir . '../sample/sections/disabling/disable-section.php';
    509 
    510 // -> START Pro Fields.
    511 if ( class_exists( 'Redux_Pro' ) ) {
    512 	Redux::set_section(
    513 		$opt_name,
    514 		array(
    515 			'title' => esc_html__( 'Redux Pro Fields', 'your-textdomain-here' ),
    516 			'id'    => 'redux-pro-fields',
    517 			'icon'  => 'el el-redux',
    518 			'class' => 'pro_highlight',
    519 			'desc'  => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/premium/" target="_blank">https://devs.redux.io/premium/</a>',
    520 		)
    521 	);
    522 
    523 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/accordion.php';
    524 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/color-scheme.php';
    525 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/custom-fonts.php';
    526 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/date-time-picker.php';
    527 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/google-maps.php';
    528 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/icon-select.php';
    529 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/js-button.php';
    530 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/multi-media.php';
    531 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/repeater.php';
    532 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/search.php';
    533 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/shortcodes.php';
    534 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/social-profiles.php';
    535 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/taxonomy.php';
    536 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/users.php';
    537 	require_once Redux_Core::$dir . '../sample/sections/pro-fields/widget-areas.php';
    538 }
    539 
    540 /**
    541  * Metaboxes
    542  */
    543 require_once Redux_Core::$dir . '../sample/metaboxes.php';
    544 
    545 /**
    546  * Raw README
    547  */
    548 if ( file_exists( $dir . '/../README.md' ) ) {
    549 	$section = array(
    550 		'icon'   => 'el el-list-alt',
    551 		'title'  => esc_html__( 'Documentation', 'your-textdomain-here' ),
    552 		'fields' => array(
    553 			array(
    554 				'id'           => 'opt-raw-documentation',
    555 				'type'         => 'raw',
    556 				'markdown'     => true,
    557 				'content_path' => dirname( __FILE__ ) . '/../README.md', // FULL PATH, not relative please.
    558 			),
    559 		),
    560 	);
    561 
    562 	Redux::set_section( $opt_name, $section );
    563 }
    564 
    565 Redux::set_section(
    566 	$opt_name,
    567 	array(
    568 		'icon'            => 'el el-list-alt',
    569 		'title'           => esc_html__( 'Customizer Only', 'your-textdomain-here' ),
    570 		'desc'            => '<p class="description">' . esc_html__( 'This Section should be visible only in Customizer', 'your-textdomain-here' ) . '</p>',
    571 		'customizer_only' => true,
    572 		'fields'          => array(
    573 			array(
    574 				'id'              => 'opt-customizer-only',
    575 				'type'            => 'select',
    576 				'title'           => esc_html__( 'Customizer Only Option', 'your-textdomain-here' ),
    577 				'subtitle'        => esc_html__( 'The subtitle is NOT visible in customizer', 'your-textdomain-here' ),
    578 				'desc'            => esc_html__( 'The field desc is NOT visible in customizer.', 'your-textdomain-here' ),
    579 				'customizer_only' => true,
    580 				'options'         => array(
    581 					'1' => esc_html__( 'Opt 1', 'your-textdomain-here' ),
    582 					'2' => esc_html__( 'Opt 2', 'your-textdomain-here' ),
    583 					'3' => esc_html__( 'Opt 3', 'your-textdomain-here' ),
    584 				),
    585 				'default'         => '2',
    586 			),
    587 		),
    588 	)
    589 );
    590 
    591 /*
    592  * <--- END SECTIONS
    593  */
    594 
    595 /*
    596  * YOU MUST PREFIX THE FUNCTIONS BELOW AND ACTION FUNCTION CALLS OR OTHER CONFIGS MAY OVERRIDE YOUR CODE.
    597  */
    598 
    599 /*
    600  * --> Action hook examples.
    601  */
    602 
    603 // Function to test the compiler hook and demo CSS output.
    604 // Above 10 is a priority, but 2 in necessary to include the dynamically generated CSS to be sent to the function.
    605 // add_filter('redux/options/' . $opt_name . '/compiler', 'compiler_action', 10, 3);
    606 //
    607 // Change the arguments after they've been declared, but before the panel is created.
    608 // add_filter('redux/options/' . $opt_name . '/args', 'change_arguments' );
    609 //
    610 // Change the default value of a field after it's been set, but before it's been useds.
    611 // add_filter('redux/options/' . $opt_name . '/defaults', 'change_defaults' );
    612 //
    613 // Dynamically add a section. Can be also used to modify sections/fields.
    614 // add_filter('redux/options/' . $opt_name . '/sections', 'dynamic_section');
    615 // .
    616 if ( ! function_exists( 'compiler_action' ) ) {
    617 	/**
    618 	 * This is a test function that will let you see when the compiler hook occurs.
    619 	 * It only runs if a field's value has changed and compiler=>true is set.
    620 	 *
    621 	 * @param array  $options        Options values.
    622 	 * @param string $css            Compiler selector CSS values  compiler => array( CSS SELECTORS ).
    623 	 * @param array  $changed_values Any values changed since last save.
    624 	 */
    625 	function compiler_action( array $options, string $css, array $changed_values ) {
    626 		echo '<h1>The compiler hook has run!</h1>';
    627 		echo '<pre>';
    628 		// phpcs:ignore WordPress.PHP.DevelopmentFunctions
    629 		print_r( $changed_values ); // Values that have changed since the last save.
    630 		// echo '<br/>';
    631 		// print_r($options); //Option values.
    632 		// echo '<br/>';
    633 		// print_r($css); // Compiler selector CSS values  compiler => array( CSS SELECTORS ).
    634 		echo '</pre>';
    635 	}
    636 }
    637 
    638 if ( ! function_exists( 'redux_validate_callback_function' ) ) {
    639 	/**
    640 	 * Custom function for the callback validation referenced above
    641 	 *
    642 	 * @param array $field          Field array.
    643 	 * @param mixed $value          New value.
    644 	 * @param mixed $existing_value Existing value.
    645 	 *
    646 	 * @return array
    647 	 */
    648 	function redux_validate_callback_function( array $field, $value, $existing_value ): array {
    649 		$error   = false;
    650 		$warning = false;
    651 
    652 		// Do your validation.
    653 		if ( 1 === (int) $value ) {
    654 			$error = true;
    655 			$value = $existing_value;
    656 		} elseif ( 2 === (int) $value ) {
    657 			$warning = true;
    658 			$value   = $existing_value;
    659 		}
    660 
    661 		$return['value'] = $value;
    662 
    663 		if ( true === $error ) {
    664 			$field['msg']    = 'your custom error message';
    665 			$return['error'] = $field;
    666 		}
    667 
    668 		if ( true === $warning ) {
    669 			$field['msg']      = 'your custom warning message';
    670 			$return['warning'] = $field;
    671 		}
    672 
    673 		return $return;
    674 	}
    675 }
    676 
    677 
    678 if ( ! function_exists( 'dynamic_section' ) ) {
    679 	/**
    680 	 * Custom function for filtering the sections array. Good for child themes to override or add to the sections.
    681 	 * Simply include this function in the child themes functions.php file.
    682 	 * NOTE: the defined constants for URLs, and directories will NOT be available at this point in a child theme,
    683 	 * so you must use get_template_directory_uri() if you want to use any of the built-in icons.
    684 	 *
    685 	 * @param array $sections Section array.
    686 	 *
    687 	 * @return array
    688 	 */
    689 	function dynamic_section( array $sections ): array {
    690 		$sections[] = array(
    691 			'title'  => esc_html__( 'Section via hook', 'your-textdomain-here' ),
    692 			'desc'   => '<p class="description">' . esc_html__( 'This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.', 'your-textdomain-here' ) . '</p>',
    693 			'icon'   => 'el el-paper-clip',
    694 
    695 			// Leave this as a blank section, no options just some intro text set above.
    696 			'fields' => array(),
    697 		);
    698 
    699 		return $sections;
    700 	}
    701 }
    702 
    703 if ( ! function_exists( 'change_arguments' ) ) {
    704 	/**
    705 	 * Filter hook for filtering the args.
    706 	 * Good for child themes to override or add to the args array. Can also be used in other functions.
    707 	 *
    708 	 * @param array $args Global arguments array.
    709 	 *
    710 	 * @return array
    711 	 */
    712 	function change_arguments( array $args ): array {
    713 		$args['dev_mode'] = true;
    714 
    715 		return $args;
    716 	}
    717 }
    718 
    719 if ( ! function_exists( 'change_defaults' ) ) {
    720 	/**
    721 	 * Filter hook for filtering the default value of any given field. Very useful in development mode.
    722 	 *
    723 	 * @param array $defaults Default value array.
    724 	 *
    725 	 * @return array
    726 	 */
    727 	function change_defaults( array $defaults ): array {
    728 		$defaults['str_replace'] = esc_html__( 'Testing filter hook!', 'your-textdomain-here' );
    729 
    730 		return $defaults;
    731 	}
    732 }
    733 
    734 if ( ! function_exists( 'redux_custom_sanitize' ) ) {
    735 	/**
    736 	 * Function to be used if the field santize argument.
    737 	 * Return value MUST be the formatted or cleaned text to display.
    738 	 *
    739 	 * @param string $value Value to evaluate or clean.  Required.
    740 	 *
    741 	 * @return string
    742 	 */
    743 	function redux_custom_sanitize( string $value ): string {
    744 		$return = '';
    745 
    746 		foreach ( explode( ' ', $value ) as $w ) {
    747 			foreach ( str_split( $w ) as $k => $v ) {
    748 				if ( ( $k + 1 ) % 2 !== 0 && ctype_alpha( $v ) ) {
    749 					$return .= mb_strtoupper( $v );
    750 				} else {
    751 					$return .= $v;
    752 				}
    753 			}
    754 
    755 			$return .= ' ';
    756 		}
    757 
    758 		return $return;
    759 	}
    760 }