callback.php (1574B)
1 <?php 2 /** 3 * Redux Framework callback 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__( 'Callback', 'your-textdomain-here' ), 15 'id' => 'additional-callback', 16 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/configuration/fields/data.html#using-a-custom-callback" target="_blank">https://devs.redux.io/configuration/fields/data.html#using-a-custom-callback</a>', 17 'subsection' => true, 18 'fields' => array( 19 array( 20 'id' => 'opt-custom-callback', 21 'type' => 'callback', 22 'title' => esc_html__( 'Custom Field Callback', 'your-textdomain-here' ), 23 'subtitle' => esc_html__( 'This is a completely unique field type', 'your-textdomain-here' ), 24 'desc' => esc_html__( 'This is created with a callback function, so anything goes in this field. Make sure to define the function though.', 'your-textdomain-here' ), 25 'callback' => 'redux_my_custom_field', 26 ), 27 ), 28 ) 29 ); 30 31 if ( ! function_exists( 'redux_my_custom_field' ) ) { 32 /** 33 * Custom function for the callback referenced above. 34 * 35 * @param array $field Field array. 36 * @param mixed $value Set value. 37 */ 38 function redux_my_custom_field( $field, $value ) { 39 print_r( $field ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions 40 echo '<br/>'; 41 print_r( $value ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions 42 } 43 }