@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | // phpcs:disabled |
| 10 | 10 | if ( ! class_exists( 'Redux' ) ) { |
| 11 | - return null; |
|
| 11 | + return null; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // This is your option name where all the Redux data is stored. |
@@ -27,184 +27,184 @@ discard block |
||
| 27 | 27 | $theme = wp_get_theme(); // For use with some settings. Not necessary. |
| 28 | 28 | |
| 29 | 29 | $args = array( |
| 30 | - // REQUIRED!! Change these values as you need/desire. |
|
| 31 | - 'opt_name' => $opt_name, |
|
| 30 | + // REQUIRED!! Change these values as you need/desire. |
|
| 31 | + 'opt_name' => $opt_name, |
|
| 32 | 32 | |
| 33 | - // Name that appears at the top of your panel. |
|
| 34 | - 'display_name' => $theme->get( 'Name' ), |
|
| 33 | + // Name that appears at the top of your panel. |
|
| 34 | + 'display_name' => $theme->get( 'Name' ), |
|
| 35 | 35 | |
| 36 | - // Version that appears at the top of your panel. |
|
| 37 | - 'display_version' => $theme->get( 'Version' ), |
|
| 36 | + // Version that appears at the top of your panel. |
|
| 37 | + 'display_version' => $theme->get( 'Version' ), |
|
| 38 | 38 | |
| 39 | - // Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only). |
|
| 40 | - 'menu_type' => 'menu', |
|
| 39 | + // Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only). |
|
| 40 | + 'menu_type' => 'menu', |
|
| 41 | 41 | |
| 42 | - // Show the sections below the admin menu item or not. |
|
| 43 | - 'allow_sub_menu' => true, |
|
| 42 | + // Show the sections below the admin menu item or not. |
|
| 43 | + 'allow_sub_menu' => true, |
|
| 44 | 44 | |
| 45 | - 'menu_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 46 | - 'page_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 45 | + 'menu_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 46 | + 'page_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 47 | 47 | |
| 48 | - // Disable this in case you want to create your own Google fonts loader. |
|
| 49 | - 'disable_google_fonts_link' => false, |
|
| 48 | + // Disable this in case you want to create your own Google fonts loader. |
|
| 49 | + 'disable_google_fonts_link' => false, |
|
| 50 | 50 | |
| 51 | - // Show the panel pages on the admin bar. |
|
| 52 | - 'admin_bar' => true, |
|
| 51 | + // Show the panel pages on the admin bar. |
|
| 52 | + 'admin_bar' => true, |
|
| 53 | 53 | |
| 54 | - // Choose an icon for the admin bar menu. |
|
| 55 | - 'admin_bar_icon' => 'dashicons-portfolio', |
|
| 54 | + // Choose an icon for the admin bar menu. |
|
| 55 | + 'admin_bar_icon' => 'dashicons-portfolio', |
|
| 56 | 56 | |
| 57 | - // Choose a priority for the admin bar menu. |
|
| 58 | - 'admin_bar_priority' => 50, |
|
| 57 | + // Choose a priority for the admin bar menu. |
|
| 58 | + 'admin_bar_priority' => 50, |
|
| 59 | 59 | |
| 60 | - // Set a different name for your global variable other than the opt_name. |
|
| 61 | - 'global_variable' => '', |
|
| 60 | + // Set a different name for your global variable other than the opt_name. |
|
| 61 | + 'global_variable' => '', |
|
| 62 | 62 | |
| 63 | - // Show the time the page took to load, etc. |
|
| 64 | - 'dev_mode' => true, |
|
| 63 | + // Show the time the page took to load, etc. |
|
| 64 | + 'dev_mode' => true, |
|
| 65 | 65 | |
| 66 | - // Enable basic customizer support. |
|
| 67 | - 'customizer' => true, |
|
| 66 | + // Enable basic customizer support. |
|
| 67 | + 'customizer' => true, |
|
| 68 | 68 | |
| 69 | - // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning. |
|
| 70 | - 'page_priority' => null, |
|
| 69 | + // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning. |
|
| 70 | + 'page_priority' => null, |
|
| 71 | 71 | |
| 72 | - // For a full list of options, visit: @link https://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters. |
|
| 73 | - 'page_parent' => 'themes.php', |
|
| 72 | + // For a full list of options, visit: @link https://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters. |
|
| 73 | + 'page_parent' => 'themes.php', |
|
| 74 | 74 | |
| 75 | - // Permissions needed to access the options panel. |
|
| 76 | - 'page_permissions' => 'manage_options', |
|
| 75 | + // Permissions needed to access the options panel. |
|
| 76 | + 'page_permissions' => 'manage_options', |
|
| 77 | 77 | |
| 78 | - // Specify a custom URL to an icon. |
|
| 79 | - 'menu_icon' => '', |
|
| 78 | + // Specify a custom URL to an icon. |
|
| 79 | + 'menu_icon' => '', |
|
| 80 | 80 | |
| 81 | - // Force your panel to always open to a specific tab (by id). |
|
| 82 | - 'last_tab' => '', |
|
| 81 | + // Force your panel to always open to a specific tab (by id). |
|
| 82 | + 'last_tab' => '', |
|
| 83 | 83 | |
| 84 | - // Icon displayed in the admin panel next to your menu_title. |
|
| 85 | - 'page_icon' => 'icon-themes', |
|
| 84 | + // Icon displayed in the admin panel next to your menu_title. |
|
| 85 | + 'page_icon' => 'icon-themes', |
|
| 86 | 86 | |
| 87 | - // Page slug used to denote the panel. |
|
| 88 | - 'page_slug' => '_options', |
|
| 87 | + // Page slug used to denote the panel. |
|
| 88 | + 'page_slug' => '_options', |
|
| 89 | 89 | |
| 90 | - // On load save the defaults to DB before user clicks save or not. |
|
| 91 | - 'save_defaults' => true, |
|
| 90 | + // On load save the defaults to DB before user clicks save or not. |
|
| 91 | + 'save_defaults' => true, |
|
| 92 | 92 | |
| 93 | - // If true, shows the default value next to each field that is not the default value. |
|
| 94 | - 'default_show' => false, |
|
| 93 | + // If true, shows the default value next to each field that is not the default value. |
|
| 94 | + 'default_show' => false, |
|
| 95 | 95 | |
| 96 | - // What to print by the field's title if the value shown is default. Suggested: *. |
|
| 97 | - 'default_mark' => '', |
|
| 96 | + // What to print by the field's title if the value shown is default. Suggested: *. |
|
| 97 | + 'default_mark' => '', |
|
| 98 | 98 | |
| 99 | - // Shows the Import/Export panel when not used as a field. |
|
| 100 | - 'show_import_export' => true, |
|
| 99 | + // Shows the Import/Export panel when not used as a field. |
|
| 100 | + 'show_import_export' => true, |
|
| 101 | 101 | |
| 102 | - // CAREFUL: These options are for advanced use only. |
|
| 103 | - 'transient_time' => 60 * MINUTE_IN_SECONDS, |
|
| 102 | + // CAREFUL: These options are for advanced use only. |
|
| 103 | + 'transient_time' => 60 * MINUTE_IN_SECONDS, |
|
| 104 | 104 | |
| 105 | - // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output. |
|
| 106 | - 'output' => true, |
|
| 105 | + // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output. |
|
| 106 | + 'output' => true, |
|
| 107 | 107 | |
| 108 | - // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head. |
|
| 109 | - 'output_tag' => true, |
|
| 108 | + // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head. |
|
| 109 | + 'output_tag' => true, |
|
| 110 | 110 | |
| 111 | - // FUTURE → Not in use yet, but reserved or partially implemented. |
|
| 112 | - // Use at your own risk. |
|
| 113 | - // Possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning! |
|
| 114 | - 'database' => '', |
|
| 111 | + // FUTURE → Not in use yet, but reserved or partially implemented. |
|
| 112 | + // Use at your own risk. |
|
| 113 | + // Possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning! |
|
| 114 | + 'database' => '', |
|
| 115 | 115 | |
| 116 | - 'compiler' => true, |
|
| 116 | + 'compiler' => true, |
|
| 117 | 117 | |
| 118 | - // Enable or disable flyout menus when hovering over a menu with submenus. |
|
| 119 | - 'flyout_submenus' => true, |
|
| 118 | + // Enable or disable flyout menus when hovering over a menu with submenus. |
|
| 119 | + 'flyout_submenus' => true, |
|
| 120 | 120 | |
| 121 | - // Mode to display fonts (auto|block|swap|fallback|optional) |
|
| 122 | - // See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display . |
|
| 123 | - 'font_display' => 'swap', |
|
| 121 | + // Mode to display fonts (auto|block|swap|fallback|optional) |
|
| 122 | + // See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display . |
|
| 123 | + 'font_display' => 'swap', |
|
| 124 | 124 | |
| 125 | - // HINTS. |
|
| 126 | - 'hints' => array( |
|
| 127 | - 'icon' => 'el el-question-sign', |
|
| 128 | - 'icon_position' => 'right', |
|
| 129 | - 'icon_color' => 'lightgray', |
|
| 130 | - 'icon_size' => 'normal', |
|
| 131 | - 'tip_style' => array( |
|
| 132 | - 'color' => 'light', |
|
| 133 | - 'shadow' => true, |
|
| 134 | - 'rounded' => false, |
|
| 135 | - 'style' => '', |
|
| 136 | - ), |
|
| 137 | - 'tip_position' => array( |
|
| 138 | - 'my' => 'top left', |
|
| 139 | - 'at' => 'bottom right', |
|
| 140 | - ), |
|
| 141 | - 'tip_effect' => array( |
|
| 142 | - 'show' => array( |
|
| 143 | - 'effect' => 'slide', |
|
| 144 | - 'duration' => '500', |
|
| 145 | - 'event' => 'mouseover', |
|
| 146 | - ), |
|
| 147 | - 'hide' => array( |
|
| 148 | - 'effect' => 'slide', |
|
| 149 | - 'duration' => '500', |
|
| 150 | - 'event' => 'click mouseleave', |
|
| 151 | - ), |
|
| 152 | - ), |
|
| 153 | - ), |
|
| 125 | + // HINTS. |
|
| 126 | + 'hints' => array( |
|
| 127 | + 'icon' => 'el el-question-sign', |
|
| 128 | + 'icon_position' => 'right', |
|
| 129 | + 'icon_color' => 'lightgray', |
|
| 130 | + 'icon_size' => 'normal', |
|
| 131 | + 'tip_style' => array( |
|
| 132 | + 'color' => 'light', |
|
| 133 | + 'shadow' => true, |
|
| 134 | + 'rounded' => false, |
|
| 135 | + 'style' => '', |
|
| 136 | + ), |
|
| 137 | + 'tip_position' => array( |
|
| 138 | + 'my' => 'top left', |
|
| 139 | + 'at' => 'bottom right', |
|
| 140 | + ), |
|
| 141 | + 'tip_effect' => array( |
|
| 142 | + 'show' => array( |
|
| 143 | + 'effect' => 'slide', |
|
| 144 | + 'duration' => '500', |
|
| 145 | + 'event' => 'mouseover', |
|
| 146 | + ), |
|
| 147 | + 'hide' => array( |
|
| 148 | + 'effect' => 'slide', |
|
| 149 | + 'duration' => '500', |
|
| 150 | + 'event' => 'click mouseleave', |
|
| 151 | + ), |
|
| 152 | + ), |
|
| 153 | + ), |
|
| 154 | 154 | ); |
| 155 | 155 | |
| 156 | 156 | // ADMIN BAR LINKS → Set up custom links in the admin bar menu as external items. |
| 157 | 157 | $args['admin_bar_links'][] = array( |
| 158 | - 'id' => 'redux-docs', |
|
| 159 | - 'href' => '//devs.redux.io/', |
|
| 160 | - 'title' => esc_html__( 'Documentation', 'your-textdomain-here' ), |
|
| 158 | + 'id' => 'redux-docs', |
|
| 159 | + 'href' => '//devs.redux.io/', |
|
| 160 | + 'title' => esc_html__( 'Documentation', 'your-textdomain-here' ), |
|
| 161 | 161 | ); |
| 162 | 162 | |
| 163 | 163 | $args['admin_bar_links'][] = array( |
| 164 | - 'id' => 'redux-support', |
|
| 165 | - 'href' => '//github.com/ReduxFramework/redux-framework/issues', |
|
| 166 | - 'title' => esc_html__( 'Support', 'your-textdomain-here' ), |
|
| 164 | + 'id' => 'redux-support', |
|
| 165 | + 'href' => '//github.com/ReduxFramework/redux-framework/issues', |
|
| 166 | + 'title' => esc_html__( 'Support', 'your-textdomain-here' ), |
|
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | 169 | $args['admin_bar_links'][] = array( |
| 170 | - 'id' => 'redux-extensions', |
|
| 171 | - 'href' => 'redux.io/extensions', |
|
| 172 | - 'title' => esc_html__( 'Extensions', 'your-textdomain-here' ), |
|
| 170 | + 'id' => 'redux-extensions', |
|
| 171 | + 'href' => 'redux.io/extensions', |
|
| 172 | + 'title' => esc_html__( 'Extensions', 'your-textdomain-here' ), |
|
| 173 | 173 | ); |
| 174 | 174 | |
| 175 | 175 | // SOCIAL ICONS → Set up custom links in the footer for quick links in your panel footer icons. |
| 176 | 176 | $args['share_icons'][] = array( |
| 177 | - 'url' => '//github.com/ReduxFramework/ReduxFramework', |
|
| 178 | - 'title' => esc_html__( 'Visit us on GitHub', 'your-textdomain-here' ), |
|
| 179 | - 'icon' => 'el el-github', |
|
| 177 | + 'url' => '//github.com/ReduxFramework/ReduxFramework', |
|
| 178 | + 'title' => esc_html__( 'Visit us on GitHub', 'your-textdomain-here' ), |
|
| 179 | + 'icon' => 'el el-github', |
|
| 180 | 180 | ); |
| 181 | 181 | $args['share_icons'][] = array( |
| 182 | - 'url' => '//www.facebook.com/pages/Redux-Framework/243141545850368', |
|
| 183 | - 'title' => esc_html__( 'Like us on Facebook', 'your-textdomain-here' ), |
|
| 184 | - 'icon' => 'el el-facebook', |
|
| 182 | + 'url' => '//www.facebook.com/pages/Redux-Framework/243141545850368', |
|
| 183 | + 'title' => esc_html__( 'Like us on Facebook', 'your-textdomain-here' ), |
|
| 184 | + 'icon' => 'el el-facebook', |
|
| 185 | 185 | ); |
| 186 | 186 | $args['share_icons'][] = array( |
| 187 | - 'url' => '//twitter.com/reduxframework', |
|
| 188 | - 'title' => esc_html__( 'Follow us on Twitter', 'your-textdomain-here' ), |
|
| 189 | - 'icon' => 'el el-twitter', |
|
| 187 | + 'url' => '//twitter.com/reduxframework', |
|
| 188 | + 'title' => esc_html__( 'Follow us on Twitter', 'your-textdomain-here' ), |
|
| 189 | + 'icon' => 'el el-twitter', |
|
| 190 | 190 | ); |
| 191 | 191 | $args['share_icons'][] = array( |
| 192 | - 'url' => '//www.linkedin.com/company/redux-framework', |
|
| 193 | - 'title' => esc_html__( 'Find us on LinkedIn', 'your-textdomain-here' ), |
|
| 194 | - 'icon' => 'el el-linkedin', |
|
| 192 | + 'url' => '//www.linkedin.com/company/redux-framework', |
|
| 193 | + 'title' => esc_html__( 'Find us on LinkedIn', 'your-textdomain-here' ), |
|
| 194 | + 'icon' => 'el el-linkedin', |
|
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | 197 | // Panel Intro text → before the form. |
| 198 | 198 | if ( false !== $args['global_variable'] ) { |
| 199 | - if ( ! empty( $args['global_variable'] ) ) { |
|
| 200 | - $v = $args['global_variable']; |
|
| 201 | - } else { |
|
| 202 | - $v = str_replace( '-', '_', $args['opt_name'] ); |
|
| 203 | - } |
|
| 199 | + if ( ! empty( $args['global_variable'] ) ) { |
|
| 200 | + $v = $args['global_variable']; |
|
| 201 | + } else { |
|
| 202 | + $v = str_replace( '-', '_', $args['opt_name'] ); |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - $args['intro_text'] = '<p>' . sprintf( __( '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: $s', 'your-textdomain-here' ) . '</p>', '<strong>' . $v . '</strong>' ); |
|
| 205 | + $args['intro_text'] = '<p>' . sprintf( __( '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: $s', 'your-textdomain-here' ) . '</p>', '<strong>' . $v . '</strong>' ); |
|
| 206 | 206 | } else { |
| 207 | - $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>'; |
|
| 207 | + $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>'; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // Add content after the form. |
@@ -221,17 +221,17 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | |
| 223 | 223 | $help_tabs = array( |
| 224 | - array( |
|
| 225 | - 'id' => 'redux-help-tab-1', |
|
| 226 | - 'title' => esc_html__( 'Theme Information 1', 'your-textdomain-here' ), |
|
| 227 | - 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 228 | - ), |
|
| 229 | - |
|
| 230 | - array( |
|
| 231 | - 'id' => 'redux-help-tab-2', |
|
| 232 | - 'title' => esc_html__( 'Theme Information 2', 'your-textdomain-here' ), |
|
| 233 | - 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 234 | - ), |
|
| 224 | + array( |
|
| 225 | + 'id' => 'redux-help-tab-1', |
|
| 226 | + 'title' => esc_html__( 'Theme Information 1', 'your-textdomain-here' ), |
|
| 227 | + 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 228 | + ), |
|
| 229 | + |
|
| 230 | + array( |
|
| 231 | + 'id' => 'redux-help-tab-2', |
|
| 232 | + 'title' => esc_html__( 'Theme Information 2', 'your-textdomain-here' ), |
|
| 233 | + 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 234 | + ), |
|
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | Redux::set_help_tab( $opt_name, $help_tabs ); |
@@ -255,77 +255,77 @@ discard block |
||
| 255 | 255 | /* -> START Basic Fields. */ |
| 256 | 256 | |
| 257 | 257 | $kses_exceptions = array( |
| 258 | - 'a' => array( |
|
| 259 | - 'href' => array(), |
|
| 260 | - ), |
|
| 261 | - 'strong' => array(), |
|
| 262 | - 'br' => array(), |
|
| 258 | + 'a' => array( |
|
| 259 | + 'href' => array(), |
|
| 260 | + ), |
|
| 261 | + 'strong' => array(), |
|
| 262 | + 'br' => array(), |
|
| 263 | 263 | ); |
| 264 | 264 | |
| 265 | 265 | $section = array( |
| 266 | - 'title' => esc_html__( 'Basic Field', 'your-textdomain-here' ), |
|
| 267 | - 'id' => 'basic', |
|
| 268 | - 'desc' => esc_html__( 'Basic field with no subsections.', 'your-textdomain-here' ), |
|
| 269 | - 'icon' => 'el el-home', |
|
| 270 | - 'fields' => array( |
|
| 271 | - array( |
|
| 272 | - 'id' => 'opt-text', |
|
| 273 | - 'type' => 'text', |
|
| 274 | - 'title' => esc_html__( 'Example Text', 'your-textdomain-here' ), |
|
| 275 | - 'desc' => esc_html__( 'Example description.', 'your-textdomain-here' ), |
|
| 276 | - 'subtitle' => esc_html__( 'Example subtitle.', 'your-textdomain-here' ), |
|
| 277 | - 'hint' => array( |
|
| 278 | - 'content' => wp_kses( __( 'This is a <strong>hint</strong> tool-tip for the text field.<br/><br/>Add any HTML-based text you like here.', 'your-textdomain-here' ), $kses_exceptions ), |
|
| 279 | - ), |
|
| 280 | - ), |
|
| 281 | - ), |
|
| 266 | + 'title' => esc_html__( 'Basic Field', 'your-textdomain-here' ), |
|
| 267 | + 'id' => 'basic', |
|
| 268 | + 'desc' => esc_html__( 'Basic field with no subsections.', 'your-textdomain-here' ), |
|
| 269 | + 'icon' => 'el el-home', |
|
| 270 | + 'fields' => array( |
|
| 271 | + array( |
|
| 272 | + 'id' => 'opt-text', |
|
| 273 | + 'type' => 'text', |
|
| 274 | + 'title' => esc_html__( 'Example Text', 'your-textdomain-here' ), |
|
| 275 | + 'desc' => esc_html__( 'Example description.', 'your-textdomain-here' ), |
|
| 276 | + 'subtitle' => esc_html__( 'Example subtitle.', 'your-textdomain-here' ), |
|
| 277 | + 'hint' => array( |
|
| 278 | + 'content' => wp_kses( __( 'This is a <strong>hint</strong> tool-tip for the text field.<br/><br/>Add any HTML-based text you like here.', 'your-textdomain-here' ), $kses_exceptions ), |
|
| 279 | + ), |
|
| 280 | + ), |
|
| 281 | + ), |
|
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | 284 | Redux::set_section( $opt_name, $section ); |
| 285 | 285 | |
| 286 | 286 | $section = array( |
| 287 | - 'title' => __( 'Basic Fields', 'your-textdomain-here' ), |
|
| 288 | - 'id' => 'basic', |
|
| 289 | - 'desc' => __( 'Basic fields as subsections.', 'your-textdomain-here' ), |
|
| 290 | - 'icon' => 'el el-home', |
|
| 287 | + 'title' => __( 'Basic Fields', 'your-textdomain-here' ), |
|
| 288 | + 'id' => 'basic', |
|
| 289 | + 'desc' => __( 'Basic fields as subsections.', 'your-textdomain-here' ), |
|
| 290 | + 'icon' => 'el el-home', |
|
| 291 | 291 | ); |
| 292 | 292 | |
| 293 | 293 | Redux::set_section( $opt_name, $section ); |
| 294 | 294 | |
| 295 | 295 | $section = array( |
| 296 | - 'title' => esc_html__( 'Text', 'your-textdomain-here' ), |
|
| 297 | - 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-fields/text.html" target="_blank">https://devs.redux.io/core-fields/text.html</a>', |
|
| 298 | - 'id' => 'opt-text-subsection', |
|
| 299 | - 'subsection' => true, |
|
| 300 | - 'fields' => array( |
|
| 301 | - array( |
|
| 302 | - 'id' => 'text-example', |
|
| 303 | - 'type' => 'text', |
|
| 304 | - 'title' => esc_html__( 'Text Field', 'your-textdomain-here' ), |
|
| 305 | - 'subtitle' => esc_html__( 'Subtitle', 'your-textdomain-here' ), |
|
| 306 | - 'desc' => esc_html__( 'Field Description', 'your-textdomain-here' ), |
|
| 307 | - 'default' => 'Default Text', |
|
| 308 | - ), |
|
| 309 | - ), |
|
| 296 | + 'title' => esc_html__( 'Text', 'your-textdomain-here' ), |
|
| 297 | + 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-fields/text.html" target="_blank">https://devs.redux.io/core-fields/text.html</a>', |
|
| 298 | + 'id' => 'opt-text-subsection', |
|
| 299 | + 'subsection' => true, |
|
| 300 | + 'fields' => array( |
|
| 301 | + array( |
|
| 302 | + 'id' => 'text-example', |
|
| 303 | + 'type' => 'text', |
|
| 304 | + 'title' => esc_html__( 'Text Field', 'your-textdomain-here' ), |
|
| 305 | + 'subtitle' => esc_html__( 'Subtitle', 'your-textdomain-here' ), |
|
| 306 | + 'desc' => esc_html__( 'Field Description', 'your-textdomain-here' ), |
|
| 307 | + 'default' => 'Default Text', |
|
| 308 | + ), |
|
| 309 | + ), |
|
| 310 | 310 | ); |
| 311 | 311 | |
| 312 | 312 | Redux::set_section( $opt_name, $section ); |
| 313 | 313 | |
| 314 | 314 | $section = array( |
| 315 | - 'title' => esc_html__( 'Text Area', 'your-textdomain-here' ), |
|
| 316 | - 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-fields/textarea.html" target="_blank">https://devs.redux.io/core-fields/textarea.html</a>', |
|
| 317 | - 'id' => 'opt-textarea-subsection', |
|
| 318 | - 'subsection' => true, |
|
| 319 | - 'fields' => array( |
|
| 320 | - array( |
|
| 321 | - 'id' => 'textarea-example', |
|
| 322 | - 'type' => 'textarea', |
|
| 323 | - 'title' => esc_html__( 'Text Area Field', 'your-textdomain-here' ), |
|
| 324 | - 'subtitle' => esc_html__( 'Subtitle', 'your-textdomain-here' ), |
|
| 325 | - 'desc' => esc_html__( 'Field Description', 'your-textdomain-here' ), |
|
| 326 | - 'default' => 'Default Text', |
|
| 327 | - ), |
|
| 328 | - ), |
|
| 315 | + 'title' => esc_html__( 'Text Area', 'your-textdomain-here' ), |
|
| 316 | + 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-fields/textarea.html" target="_blank">https://devs.redux.io/core-fields/textarea.html</a>', |
|
| 317 | + 'id' => 'opt-textarea-subsection', |
|
| 318 | + 'subsection' => true, |
|
| 319 | + 'fields' => array( |
|
| 320 | + array( |
|
| 321 | + 'id' => 'textarea-example', |
|
| 322 | + 'type' => 'textarea', |
|
| 323 | + 'title' => esc_html__( 'Text Area Field', 'your-textdomain-here' ), |
|
| 324 | + 'subtitle' => esc_html__( 'Subtitle', 'your-textdomain-here' ), |
|
| 325 | + 'desc' => esc_html__( 'Field Description', 'your-textdomain-here' ), |
|
| 326 | + 'default' => 'Default Text', |
|
| 327 | + ), |
|
| 328 | + ), |
|
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | 331 | Redux::set_section( $opt_name, $section ); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | defined( 'ABSPATH' ) || exit; |
| 11 | 11 | |
| 12 | 12 | if ( ! class_exists( 'Redux' ) ) { |
| 13 | - return; |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // This is your option name where all the Redux data is stored. |
@@ -31,32 +31,32 @@ discard block |
||
| 31 | 31 | $sample_patterns = array(); |
| 32 | 32 | |
| 33 | 33 | if ( is_dir( $sample_patterns_path ) ) { |
| 34 | - $sample_patterns_dir = opendir( $sample_patterns_path ); |
|
| 35 | - |
|
| 36 | - if ( $sample_patterns_dir ) { |
|
| 37 | - |
|
| 38 | - // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition |
|
| 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 | - } |
|
| 34 | + $sample_patterns_dir = opendir( $sample_patterns_path ); |
|
| 35 | + |
|
| 36 | + if ( $sample_patterns_dir ) { |
|
| 37 | + |
|
| 38 | + // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition |
|
| 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 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Used to except HTML tags in description arguments where esc_html would remove. |
| 53 | 53 | $kses_exceptions = array( |
| 54 | - 'a' => array( |
|
| 55 | - 'href' => array(), |
|
| 56 | - ), |
|
| 57 | - 'strong' => array(), |
|
| 58 | - 'br' => array(), |
|
| 59 | - 'code' => array(), |
|
| 54 | + 'a' => array( |
|
| 55 | + 'href' => array(), |
|
| 56 | + ), |
|
| 57 | + 'strong' => array(), |
|
| 58 | + 'br' => array(), |
|
| 59 | + 'code' => array(), |
|
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | 62 | /* |
@@ -71,155 +71,155 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | // TYPICAL → Change these values as you need/desire. |
| 73 | 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, |
|
| 74 | + // This is where your data is stored in the database and also becomes your global variable name. |
|
| 75 | + 'opt_name' => $opt_name, |
|
| 76 | 76 | |
| 77 | - // Name that appears at the top of your panel. |
|
| 78 | - 'display_name' => $theme->get( 'Name' ), |
|
| 77 | + // Name that appears at the top of your panel. |
|
| 78 | + 'display_name' => $theme->get( 'Name' ), |
|
| 79 | 79 | |
| 80 | - // Version that appears at the top of your panel. |
|
| 81 | - 'display_version' => $theme->get( 'Version' ), |
|
| 80 | + // Version that appears at the top of your panel. |
|
| 81 | + 'display_version' => $theme->get( 'Version' ), |
|
| 82 | 82 | |
| 83 | - // Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only). |
|
| 84 | - 'menu_type' => 'menu', |
|
| 83 | + // Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only). |
|
| 84 | + 'menu_type' => 'menu', |
|
| 85 | 85 | |
| 86 | - // Show the sections below the admin menu item or not. |
|
| 87 | - 'allow_sub_menu' => true, |
|
| 86 | + // Show the sections below the admin menu item or not. |
|
| 87 | + 'allow_sub_menu' => true, |
|
| 88 | 88 | |
| 89 | - // The text to appear in the admin menu. |
|
| 90 | - 'menu_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 89 | + // The text to appear in the admin menu. |
|
| 90 | + 'menu_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 91 | 91 | |
| 92 | - // The text to appear on the page title. |
|
| 93 | - 'page_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 92 | + // The text to appear on the page title. |
|
| 93 | + 'page_title' => esc_html__( 'Sample Options', 'your-textdomain-here' ), |
|
| 94 | 94 | |
| 95 | - // Disable to create your own Google fonts loader. |
|
| 96 | - 'disable_google_fonts_link' => false, |
|
| 95 | + // Disable to create your own Google fonts loader. |
|
| 96 | + 'disable_google_fonts_link' => false, |
|
| 97 | 97 | |
| 98 | - // Show the panel pages on the admin bar. |
|
| 99 | - 'admin_bar' => true, |
|
| 98 | + // Show the panel pages on the admin bar. |
|
| 99 | + 'admin_bar' => true, |
|
| 100 | 100 | |
| 101 | - // Icon for the admin bar menu. |
|
| 102 | - 'admin_bar_icon' => 'dashicons-portfolio', |
|
| 101 | + // Icon for the admin bar menu. |
|
| 102 | + 'admin_bar_icon' => 'dashicons-portfolio', |
|
| 103 | 103 | |
| 104 | - // Priority for the admin bar menu. |
|
| 105 | - 'admin_bar_priority' => 50, |
|
| 104 | + // Priority for the admin bar menu. |
|
| 105 | + 'admin_bar_priority' => 50, |
|
| 106 | 106 | |
| 107 | - // Sets a different name for your global variable other than the opt_name. |
|
| 108 | - 'global_variable' => $opt_name, |
|
| 107 | + // Sets a different name for your global variable other than the opt_name. |
|
| 108 | + 'global_variable' => $opt_name, |
|
| 109 | 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, |
|
| 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 | 112 | |
| 113 | - // Enable basic customizer support. |
|
| 114 | - 'customizer' => true, |
|
| 113 | + // Enable basic customizer support. |
|
| 114 | + 'customizer' => true, |
|
| 115 | 115 | |
| 116 | - // Allow the panel to open expanded. |
|
| 117 | - 'open_expanded' => false, |
|
| 116 | + // Allow the panel to open expanded. |
|
| 117 | + 'open_expanded' => false, |
|
| 118 | 118 | |
| 119 | - // Disable the save warning when a user changes a field. |
|
| 120 | - 'disable_save_warn' => false, |
|
| 119 | + // Disable the save warning when a user changes a field. |
|
| 120 | + 'disable_save_warn' => false, |
|
| 121 | 121 | |
| 122 | - // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning. |
|
| 123 | - 'page_priority' => 90, |
|
| 122 | + // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning. |
|
| 123 | + 'page_priority' => 90, |
|
| 124 | 124 | |
| 125 | - // For a full list of options, visit: https://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters. |
|
| 126 | - 'page_parent' => 'themes.php', |
|
| 125 | + // For a full list of options, visit: https://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters. |
|
| 126 | + 'page_parent' => 'themes.php', |
|
| 127 | 127 | |
| 128 | - // Permissions needed to access the options panel. |
|
| 129 | - 'page_permissions' => 'manage_options', |
|
| 128 | + // Permissions needed to access the options panel. |
|
| 129 | + 'page_permissions' => 'manage_options', |
|
| 130 | 130 | |
| 131 | - // Specify a custom URL to an icon. |
|
| 132 | - 'menu_icon' => '', |
|
| 131 | + // Specify a custom URL to an icon. |
|
| 132 | + 'menu_icon' => '', |
|
| 133 | 133 | |
| 134 | - // Force your panel to always open to a specific tab (by id). |
|
| 135 | - 'last_tab' => '', |
|
| 134 | + // Force your panel to always open to a specific tab (by id). |
|
| 135 | + 'last_tab' => '', |
|
| 136 | 136 | |
| 137 | - // Icon displayed in the admin panel next to your menu_title. |
|
| 138 | - 'page_icon' => 'icon-themes', |
|
| 137 | + // Icon displayed in the admin panel next to your menu_title. |
|
| 138 | + 'page_icon' => 'icon-themes', |
|
| 139 | 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, |
|
| 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 | 142 | |
| 143 | - // On load save the defaults to DB before user clicks save. |
|
| 144 | - 'save_defaults' => true, |
|
| 143 | + // On load save the defaults to DB before user clicks save. |
|
| 144 | + 'save_defaults' => true, |
|
| 145 | 145 | |
| 146 | - // Display the default value next to each field when not set to the default value. |
|
| 147 | - 'default_show' => false, |
|
| 146 | + // Display the default value next to each field when not set to the default value. |
|
| 147 | + 'default_show' => false, |
|
| 148 | 148 | |
| 149 | - // What to print by the field's title if the value shown is default. |
|
| 150 | - 'default_mark' => '*', |
|
| 149 | + // What to print by the field's title if the value shown is default. |
|
| 150 | + 'default_mark' => '*', |
|
| 151 | 151 | |
| 152 | - // Shows the Import/Export panel when not used as a field. |
|
| 153 | - 'show_import_export' => true, |
|
| 152 | + // Shows the Import/Export panel when not used as a field. |
|
| 153 | + 'show_import_export' => true, |
|
| 154 | 154 | |
| 155 | - // Shows the Options Object for debugging purposes. Show be set to false before deploying. |
|
| 156 | - 'show_options_object' => true, |
|
| 155 | + // Shows the Options Object for debugging purposes. Show be set to false before deploying. |
|
| 156 | + 'show_options_object' => true, |
|
| 157 | 157 | |
| 158 | - // The time transients will expire when the 'database' arg is set. |
|
| 159 | - 'transient_time' => 60 * MINUTE_IN_SECONDS, |
|
| 158 | + // The time transients will expire when the 'database' arg is set. |
|
| 159 | + 'transient_time' => 60 * MINUTE_IN_SECONDS, |
|
| 160 | 160 | |
| 161 | - // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output. |
|
| 162 | - 'output' => true, |
|
| 161 | + // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output. |
|
| 162 | + 'output' => true, |
|
| 163 | 163 | |
| 164 | - // Allows dynamic CSS to be generated for customizer and google fonts, |
|
| 165 | - // but stops the dynamic CSS from going to the page head. |
|
| 166 | - 'output_tag' => true, |
|
| 164 | + // Allows dynamic CSS to be generated for customizer and google fonts, |
|
| 165 | + // but stops the dynamic CSS from going to the page head. |
|
| 166 | + 'output_tag' => true, |
|
| 167 | 167 | |
| 168 | - // Disable the footer credit of Redux. Please leave if you can help it. |
|
| 169 | - 'footer_credit' => '', |
|
| 168 | + // Disable the footer credit of Redux. Please leave if you can help it. |
|
| 169 | + 'footer_credit' => '', |
|
| 170 | 170 | |
| 171 | - // If you prefer not to use the CDN for ACE Editor. |
|
| 172 | - // You may download the Redux Vendor Support plugin to run locally or embed it in your code. |
|
| 173 | - 'use_cdn' => true, |
|
| 171 | + // If you prefer not to use the CDN for ACE Editor. |
|
| 172 | + // You may download the Redux Vendor Support plugin to run locally or embed it in your code. |
|
| 173 | + 'use_cdn' => true, |
|
| 174 | 174 | |
| 175 | - // Set the theme of the option panel. Use 'wp' to use a more modern style, default is classic. |
|
| 176 | - 'admin_theme' => 'wp', |
|
| 175 | + // Set the theme of the option panel. Use 'wp' to use a more modern style, default is classic. |
|
| 176 | + 'admin_theme' => 'wp', |
|
| 177 | 177 | |
| 178 | - // Enable or disable flyout menus when hovering over a menu with submenus. |
|
| 179 | - 'flyout_submenus' => true, |
|
| 178 | + // Enable or disable flyout menus when hovering over a menu with submenus. |
|
| 179 | + 'flyout_submenus' => true, |
|
| 180 | 180 | |
| 181 | - // Mode to display fonts (auto|block|swap|fallback|optional) |
|
| 182 | - // See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display. |
|
| 183 | - 'font_display' => 'swap', |
|
| 181 | + // Mode to display fonts (auto|block|swap|fallback|optional) |
|
| 182 | + // See: https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display. |
|
| 183 | + 'font_display' => 'swap', |
|
| 184 | 184 | |
| 185 | - // HINTS. |
|
| 186 | - 'hints' => array( |
|
| 187 | - 'icon' => 'el el-question-sign', |
|
| 188 | - 'icon_position' => 'right', |
|
| 189 | - 'icon_color' => 'lightgray', |
|
| 190 | - 'icon_size' => 'normal', |
|
| 191 | - 'tip_style' => array( |
|
| 192 | - 'color' => 'red', |
|
| 193 | - 'shadow' => true, |
|
| 194 | - 'rounded' => false, |
|
| 195 | - 'style' => '', |
|
| 196 | - ), |
|
| 197 | - 'tip_position' => array( |
|
| 198 | - 'my' => 'top left', |
|
| 199 | - 'at' => 'bottom right', |
|
| 200 | - ), |
|
| 201 | - 'tip_effect' => array( |
|
| 202 | - 'show' => array( |
|
| 203 | - 'effect' => 'slide', |
|
| 204 | - 'duration' => '500', |
|
| 205 | - 'event' => 'mouseover', |
|
| 206 | - ), |
|
| 207 | - 'hide' => array( |
|
| 208 | - 'effect' => 'slide', |
|
| 209 | - 'duration' => '500', |
|
| 210 | - 'event' => 'click mouseleave', |
|
| 211 | - ), |
|
| 212 | - ), |
|
| 213 | - ), |
|
| 214 | - |
|
| 215 | - // FUTURE → Not in use yet, but reserved or partially implemented. |
|
| 216 | - // Use at your own risk. |
|
| 217 | - // Possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning! |
|
| 218 | - 'database' => '', |
|
| 219 | - 'network_admin' => true, |
|
| 220 | - 'search' => true, |
|
| 221 | - 'widget_area' => true, |
|
| 222 | - 'custom_fonts' => true, |
|
| 185 | + // HINTS. |
|
| 186 | + 'hints' => array( |
|
| 187 | + 'icon' => 'el el-question-sign', |
|
| 188 | + 'icon_position' => 'right', |
|
| 189 | + 'icon_color' => 'lightgray', |
|
| 190 | + 'icon_size' => 'normal', |
|
| 191 | + 'tip_style' => array( |
|
| 192 | + 'color' => 'red', |
|
| 193 | + 'shadow' => true, |
|
| 194 | + 'rounded' => false, |
|
| 195 | + 'style' => '', |
|
| 196 | + ), |
|
| 197 | + 'tip_position' => array( |
|
| 198 | + 'my' => 'top left', |
|
| 199 | + 'at' => 'bottom right', |
|
| 200 | + ), |
|
| 201 | + 'tip_effect' => array( |
|
| 202 | + 'show' => array( |
|
| 203 | + 'effect' => 'slide', |
|
| 204 | + 'duration' => '500', |
|
| 205 | + 'event' => 'mouseover', |
|
| 206 | + ), |
|
| 207 | + 'hide' => array( |
|
| 208 | + 'effect' => 'slide', |
|
| 209 | + 'duration' => '500', |
|
| 210 | + 'event' => 'click mouseleave', |
|
| 211 | + ), |
|
| 212 | + ), |
|
| 213 | + ), |
|
| 214 | + |
|
| 215 | + // FUTURE → Not in use yet, but reserved or partially implemented. |
|
| 216 | + // Use at your own risk. |
|
| 217 | + // Possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning! |
|
| 218 | + 'database' => '', |
|
| 219 | + 'network_admin' => true, |
|
| 220 | + 'search' => true, |
|
| 221 | + 'widget_area' => true, |
|
| 222 | + 'custom_fonts' => true, |
|
| 223 | 223 | ); |
| 224 | 224 | |
| 225 | 225 | |
@@ -227,53 +227,53 @@ discard block |
||
| 227 | 227 | // PLEASE CHANGE THESE SETTINGS IN YOUR THEME BEFORE RELEASING YOUR PRODUCT!! |
| 228 | 228 | // If these are left unchanged, they will not display in your panel! |
| 229 | 229 | $args['admin_bar_links'][] = array( |
| 230 | - 'id' => 'redux-docs', |
|
| 231 | - 'href' => '//devs.redux.io/', |
|
| 232 | - 'title' => __( 'Documentation', 'your-textdomain-here' ), |
|
| 230 | + 'id' => 'redux-docs', |
|
| 231 | + 'href' => '//devs.redux.io/', |
|
| 232 | + 'title' => __( 'Documentation', 'your-textdomain-here' ), |
|
| 233 | 233 | ); |
| 234 | 234 | |
| 235 | 235 | $args['admin_bar_links'][] = array( |
| 236 | - 'id' => 'redux-support', |
|
| 237 | - 'href' => '//github.com/ReduxFramework/redux-framework/issues', |
|
| 238 | - 'title' => __( 'Support', 'your-textdomain-here' ), |
|
| 236 | + 'id' => 'redux-support', |
|
| 237 | + 'href' => '//github.com/ReduxFramework/redux-framework/issues', |
|
| 238 | + 'title' => __( 'Support', 'your-textdomain-here' ), |
|
| 239 | 239 | ); |
| 240 | 240 | |
| 241 | 241 | // SOCIAL ICONS → Set up custom links in the footer for quick links in your panel footer icons. |
| 242 | 242 | // PLEASE CHANGE THESE SETTINGS IN YOUR THEME BEFORE RELEASING YOUR PRODUCT!! |
| 243 | 243 | // If these are left unchanged, they will not display in your panel! |
| 244 | 244 | $args['share_icons'][] = array( |
| 245 | - 'url' => '//github.com/ReduxFramework/ReduxFramework', |
|
| 246 | - 'title' => __( 'Visit us on GitHub', 'your-textdomain-here' ), |
|
| 247 | - 'icon' => 'el el-github', |
|
| 245 | + 'url' => '//github.com/ReduxFramework/ReduxFramework', |
|
| 246 | + 'title' => __( 'Visit us on GitHub', 'your-textdomain-here' ), |
|
| 247 | + 'icon' => 'el el-github', |
|
| 248 | 248 | ); |
| 249 | 249 | $args['share_icons'][] = array( |
| 250 | - 'url' => '//www.facebook.com/pages/Redux-Framework/243141545850368', |
|
| 251 | - 'title' => __( 'Like us on Facebook', 'your-textdomain-here' ), |
|
| 252 | - 'icon' => 'el el-facebook', |
|
| 250 | + 'url' => '//www.facebook.com/pages/Redux-Framework/243141545850368', |
|
| 251 | + 'title' => __( 'Like us on Facebook', 'your-textdomain-here' ), |
|
| 252 | + 'icon' => 'el el-facebook', |
|
| 253 | 253 | ); |
| 254 | 254 | $args['share_icons'][] = array( |
| 255 | - 'url' => '//twitter.com/reduxframework', |
|
| 256 | - 'title' => __( 'Follow us on Twitter', 'your-textdomain-here' ), |
|
| 257 | - 'icon' => 'el el-twitter', |
|
| 255 | + 'url' => '//twitter.com/reduxframework', |
|
| 256 | + 'title' => __( 'Follow us on Twitter', 'your-textdomain-here' ), |
|
| 257 | + 'icon' => 'el el-twitter', |
|
| 258 | 258 | ); |
| 259 | 259 | $args['share_icons'][] = array( |
| 260 | - 'url' => '//www.linkedin.com/company/redux-framework', |
|
| 261 | - 'title' => __( 'Find us on LinkedIn', 'your-textdomain-here' ), |
|
| 262 | - 'icon' => 'el el-linkedin', |
|
| 260 | + 'url' => '//www.linkedin.com/company/redux-framework', |
|
| 261 | + 'title' => __( 'Find us on LinkedIn', 'your-textdomain-here' ), |
|
| 262 | + 'icon' => 'el el-linkedin', |
|
| 263 | 263 | ); |
| 264 | 264 | |
| 265 | 265 | // Panel Intro text → before the form. |
| 266 | 266 | if ( ! isset( $args['global_variable'] ) || false !== $args['global_variable'] ) { |
| 267 | - if ( ! empty( $args['global_variable'] ) ) { |
|
| 268 | - $v = $args['global_variable']; |
|
| 269 | - } else { |
|
| 270 | - $v = str_replace( '-', '_', $args['opt_name'] ); |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - // translators: Panel opt_name. |
|
| 274 | - $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>'; |
|
| 267 | + if ( ! empty( $args['global_variable'] ) ) { |
|
| 268 | + $v = $args['global_variable']; |
|
| 269 | + } else { |
|
| 270 | + $v = str_replace( '-', '_', $args['opt_name'] ); |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + // translators: Panel opt_name. |
|
| 274 | + $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>'; |
|
| 275 | 275 | } else { |
| 276 | - $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 | + $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>'; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // Add content after the form. |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | * ---> START HELP TABS |
| 290 | 290 | */ |
| 291 | 291 | $help_tabs = array( |
| 292 | - array( |
|
| 293 | - 'id' => 'redux-help-tab-1', |
|
| 294 | - 'title' => esc_html__( 'Theme Information 1', 'your-textdomain-here' ), |
|
| 295 | - 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 296 | - ), |
|
| 297 | - array( |
|
| 298 | - 'id' => 'redux-help-tab-2', |
|
| 299 | - 'title' => esc_html__( 'Theme Information 2', 'your-textdomain-here' ), |
|
| 300 | - 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 301 | - ), |
|
| 292 | + array( |
|
| 293 | + 'id' => 'redux-help-tab-1', |
|
| 294 | + 'title' => esc_html__( 'Theme Information 1', 'your-textdomain-here' ), |
|
| 295 | + 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 296 | + ), |
|
| 297 | + array( |
|
| 298 | + 'id' => 'redux-help-tab-2', |
|
| 299 | + 'title' => esc_html__( 'Theme Information 2', 'your-textdomain-here' ), |
|
| 300 | + 'content' => '<p>' . esc_html__( 'This is the tab content, HTML is allowed.', 'your-textdomain-here' ) . '</p>', |
|
| 301 | + ), |
|
| 302 | 302 | ); |
| 303 | 303 | Redux::set_help_tab( $opt_name, $help_tabs ); |
| 304 | 304 | |
@@ -317,14 +317,14 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | // -> START Basic Fields |
| 319 | 319 | Redux::set_section( |
| 320 | - $opt_name, |
|
| 321 | - array( |
|
| 322 | - 'title' => esc_html__( 'Basic Fields', 'your-textdomain-here' ), |
|
| 323 | - 'id' => 'basic', |
|
| 324 | - 'desc' => esc_html__( 'These are really basic fields!', 'your-textdomain-here' ), |
|
| 325 | - 'customizer_width' => '400px', |
|
| 326 | - 'icon' => 'el el-home', |
|
| 327 | - ) |
|
| 320 | + $opt_name, |
|
| 321 | + array( |
|
| 322 | + 'title' => esc_html__( 'Basic Fields', 'your-textdomain-here' ), |
|
| 323 | + 'id' => 'basic', |
|
| 324 | + 'desc' => esc_html__( 'These are really basic fields!', 'your-textdomain-here' ), |
|
| 325 | + 'customizer_width' => '400px', |
|
| 326 | + 'icon' => 'el el-home', |
|
| 327 | + ) |
|
| 328 | 328 | ); |
| 329 | 329 | |
| 330 | 330 | require_once Redux_Core::$dir . '../sample/sections/basic-fields/checkbox.php'; |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | // -> START Editors. |
| 339 | 339 | Redux::set_section( |
| 340 | - $opt_name, |
|
| 341 | - array( |
|
| 342 | - 'title' => esc_html__( 'Editors', 'your-textdomain-here' ), |
|
| 343 | - 'id' => 'editor', |
|
| 344 | - 'customizer_width' => '500px', |
|
| 345 | - 'icon' => 'el el-edit', |
|
| 346 | - ) |
|
| 340 | + $opt_name, |
|
| 341 | + array( |
|
| 342 | + 'title' => esc_html__( 'Editors', 'your-textdomain-here' ), |
|
| 343 | + 'id' => 'editor', |
|
| 344 | + 'customizer_width' => '500px', |
|
| 345 | + 'icon' => 'el el-edit', |
|
| 346 | + ) |
|
| 347 | 347 | ); |
| 348 | 348 | |
| 349 | 349 | require_once Redux_Core::$dir . '../sample/sections/editors/wordpress-editor.php'; |
@@ -351,12 +351,12 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | // -> START Color Selection. |
| 353 | 353 | Redux::set_section( |
| 354 | - $opt_name, |
|
| 355 | - array( |
|
| 356 | - 'title' => esc_html__( 'Color Selection', 'your-textdomain-here' ), |
|
| 357 | - 'id' => 'color', |
|
| 358 | - 'icon' => 'el el-brush', |
|
| 359 | - ) |
|
| 354 | + $opt_name, |
|
| 355 | + array( |
|
| 356 | + 'title' => esc_html__( 'Color Selection', 'your-textdomain-here' ), |
|
| 357 | + 'id' => 'color', |
|
| 358 | + 'icon' => 'el el-brush', |
|
| 359 | + ) |
|
| 360 | 360 | ); |
| 361 | 361 | |
| 362 | 362 | require_once Redux_Core::$dir . '../sample/sections/color-selection/color.php'; |
@@ -368,12 +368,12 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | // -> START Design Fields. |
| 370 | 370 | Redux::set_section( |
| 371 | - $opt_name, |
|
| 372 | - array( |
|
| 373 | - 'title' => esc_html__( 'Design Fields', 'your-textdomain-here' ), |
|
| 374 | - 'id' => 'design', |
|
| 375 | - 'icon' => 'el el-wrench', |
|
| 376 | - ) |
|
| 371 | + $opt_name, |
|
| 372 | + array( |
|
| 373 | + 'title' => esc_html__( 'Design Fields', 'your-textdomain-here' ), |
|
| 374 | + 'id' => 'design', |
|
| 375 | + 'icon' => 'el el-wrench', |
|
| 376 | + ) |
|
| 377 | 377 | ); |
| 378 | 378 | |
| 379 | 379 | require_once Redux_Core::$dir . '../sample/sections/design-fields/background.php'; |
@@ -384,12 +384,12 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | // -> START Media Uploads. |
| 386 | 386 | Redux::set_section( |
| 387 | - $opt_name, |
|
| 388 | - array( |
|
| 389 | - 'title' => esc_html__( 'Media Uploads', 'your-textdomain-here' ), |
|
| 390 | - 'id' => 'media', |
|
| 391 | - 'icon' => 'el el-picture', |
|
| 392 | - ) |
|
| 387 | + $opt_name, |
|
| 388 | + array( |
|
| 389 | + 'title' => esc_html__( 'Media Uploads', 'your-textdomain-here' ), |
|
| 390 | + 'id' => 'media', |
|
| 391 | + 'icon' => 'el el-picture', |
|
| 392 | + ) |
|
| 393 | 393 | ); |
| 394 | 394 | |
| 395 | 395 | require_once Redux_Core::$dir . '../sample/sections/media-uploads/gallery.php'; |
@@ -399,12 +399,12 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | // -> START Presentation Fields. |
| 401 | 401 | Redux::set_section( |
| 402 | - $opt_name, |
|
| 403 | - array( |
|
| 404 | - 'title' => esc_html__( 'Presentation Fields', 'your-textdomain-here' ), |
|
| 405 | - 'id' => 'presentation', |
|
| 406 | - 'icon' => 'el el-screen', |
|
| 407 | - ) |
|
| 402 | + $opt_name, |
|
| 403 | + array( |
|
| 404 | + 'title' => esc_html__( 'Presentation Fields', 'your-textdomain-here' ), |
|
| 405 | + 'id' => 'presentation', |
|
| 406 | + 'icon' => 'el el-screen', |
|
| 407 | + ) |
|
| 408 | 408 | ); |
| 409 | 409 | |
| 410 | 410 | require_once Redux_Core::$dir . '../sample/sections/presentation-fields/divide.php'; |
@@ -413,21 +413,21 @@ discard block |
||
| 413 | 413 | require_once Redux_Core::$dir . '../sample/sections/presentation-fields/section.php'; |
| 414 | 414 | |
| 415 | 415 | Redux::set_section( |
| 416 | - $opt_name, |
|
| 417 | - array( |
|
| 418 | - 'id' => 'presentation-divide-sample', |
|
| 419 | - 'type' => 'divide', |
|
| 420 | - ) |
|
| 416 | + $opt_name, |
|
| 417 | + array( |
|
| 418 | + 'id' => 'presentation-divide-sample', |
|
| 419 | + 'type' => 'divide', |
|
| 420 | + ) |
|
| 421 | 421 | ); |
| 422 | 422 | |
| 423 | 423 | // → START Switch & Button Set. |
| 424 | 424 | Redux::set_section( |
| 425 | - $opt_name, |
|
| 426 | - array( |
|
| 427 | - 'title' => esc_html__( 'Switch / Button Set', 'your-textdomain-here' ), |
|
| 428 | - 'id' => 'switch_buttonset', |
|
| 429 | - 'icon' => 'el el-cogs', |
|
| 430 | - ) |
|
| 425 | + $opt_name, |
|
| 426 | + array( |
|
| 427 | + 'title' => esc_html__( 'Switch / Button Set', 'your-textdomain-here' ), |
|
| 428 | + 'id' => 'switch_buttonset', |
|
| 429 | + 'icon' => 'el el-cogs', |
|
| 430 | + ) |
|
| 431 | 431 | ); |
| 432 | 432 | |
| 433 | 433 | require_once Redux_Core::$dir . '../sample/sections/switch-button/button-set.php'; |
@@ -435,12 +435,12 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | // -> START Select Fields. |
| 437 | 437 | Redux::set_section( |
| 438 | - $opt_name, |
|
| 439 | - array( |
|
| 440 | - 'title' => esc_html__( 'Select Fields', 'your-textdomain-here' ), |
|
| 441 | - 'id' => 'select', |
|
| 442 | - 'icon' => 'el el-list-alt', |
|
| 443 | - ) |
|
| 438 | + $opt_name, |
|
| 439 | + array( |
|
| 440 | + 'title' => esc_html__( 'Select Fields', 'your-textdomain-here' ), |
|
| 441 | + 'id' => 'select', |
|
| 442 | + 'icon' => 'el el-list-alt', |
|
| 443 | + ) |
|
| 444 | 444 | ); |
| 445 | 445 | |
| 446 | 446 | require_once Redux_Core::$dir . '../sample/sections/select-fields/select.php'; |
@@ -449,12 +449,12 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // -> START Slider / Spinner. |
| 451 | 451 | Redux::set_section( |
| 452 | - $opt_name, |
|
| 453 | - array( |
|
| 454 | - 'title' => esc_html__( 'Slider / Spinner', 'your-textdomain-here' ), |
|
| 455 | - 'id' => 'slider_spinner', |
|
| 456 | - 'icon' => 'el el-adjust-alt', |
|
| 457 | - ) |
|
| 452 | + $opt_name, |
|
| 453 | + array( |
|
| 454 | + 'title' => esc_html__( 'Slider / Spinner', 'your-textdomain-here' ), |
|
| 455 | + 'id' => 'slider_spinner', |
|
| 456 | + 'icon' => 'el el-adjust-alt', |
|
| 457 | + ) |
|
| 458 | 458 | ); |
| 459 | 459 | |
| 460 | 460 | require_once Redux_Core::$dir . '../sample/sections/slider-spinner/slider.php'; |
@@ -465,12 +465,12 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | // -> START Additional Types. |
| 467 | 467 | Redux::set_section( |
| 468 | - $opt_name, |
|
| 469 | - array( |
|
| 470 | - 'title' => esc_html__( 'Additional Types', 'your-textdomain-here' ), |
|
| 471 | - 'id' => 'additional', |
|
| 472 | - 'icon' => 'el el-magic', |
|
| 473 | - ) |
|
| 468 | + $opt_name, |
|
| 469 | + array( |
|
| 470 | + 'title' => esc_html__( 'Additional Types', 'your-textdomain-here' ), |
|
| 471 | + 'id' => 'additional', |
|
| 472 | + 'icon' => 'el el-magic', |
|
| 473 | + ) |
|
| 474 | 474 | ); |
| 475 | 475 | |
| 476 | 476 | require_once Redux_Core::$dir . '../sample/sections/additional-types/date.php'; |
@@ -479,11 +479,11 @@ discard block |
||
| 479 | 479 | require_once Redux_Core::$dir . '../sample/sections/additional-types/raw.php'; |
| 480 | 480 | |
| 481 | 481 | Redux::set_section( |
| 482 | - $opt_name, |
|
| 483 | - array( |
|
| 484 | - 'title' => esc_html__( 'Advanced Features', 'your-textdomain-here' ), |
|
| 485 | - 'icon' => 'el el-thumbs-up', |
|
| 486 | - ) |
|
| 482 | + $opt_name, |
|
| 483 | + array( |
|
| 484 | + 'title' => esc_html__( 'Advanced Features', 'your-textdomain-here' ), |
|
| 485 | + 'icon' => 'el el-thumbs-up', |
|
| 486 | + ) |
|
| 487 | 487 | ); |
| 488 | 488 | |
| 489 | 489 | require_once Redux_Core::$dir . '../sample/sections/advanced-features/callback.php'; |
@@ -501,11 +501,11 @@ discard block |
||
| 501 | 501 | |
| 502 | 502 | // -> START Disabling. |
| 503 | 503 | Redux::set_section( |
| 504 | - $opt_name, |
|
| 505 | - array( |
|
| 506 | - 'title' => esc_html__( 'Disabling', 'your-textdomain-here' ), |
|
| 507 | - 'icon' => 'el el-lock', |
|
| 508 | - ) |
|
| 504 | + $opt_name, |
|
| 505 | + array( |
|
| 506 | + 'title' => esc_html__( 'Disabling', 'your-textdomain-here' ), |
|
| 507 | + 'icon' => 'el el-lock', |
|
| 508 | + ) |
|
| 509 | 509 | ); |
| 510 | 510 | |
| 511 | 511 | require_once Redux_Core::$dir . '../sample/sections/disabling/disable-field.php'; |
@@ -513,14 +513,14 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | // -> START Extensions. |
| 515 | 515 | Redux::set_section( |
| 516 | - $opt_name, |
|
| 517 | - array( |
|
| 518 | - 'title' => esc_html__( 'Redux Extensions', 'your-textdomain-here' ), |
|
| 519 | - 'id' => 'redux-extensions', |
|
| 520 | - 'icon' => 'el el-redux', |
|
| 521 | - 'class' => 'pro_highlight', |
|
| 522 | - 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/" target="_blank">https://devs.redux.io/core-extensions/</a>', |
|
| 523 | - ) |
|
| 516 | + $opt_name, |
|
| 517 | + array( |
|
| 518 | + 'title' => esc_html__( 'Redux Extensions', 'your-textdomain-here' ), |
|
| 519 | + 'id' => 'redux-extensions', |
|
| 520 | + 'icon' => 'el el-redux', |
|
| 521 | + 'class' => 'pro_highlight', |
|
| 522 | + 'desc' => esc_html__( 'For full documentation on this field, visit: ', 'your-textdomain-here' ) . '<a href="https://devs.redux.io/core-extensions/" target="_blank">https://devs.redux.io/core-extensions/</a>', |
|
| 523 | + ) |
|
| 524 | 524 | ); |
| 525 | 525 | |
| 526 | 526 | require_once Redux_Core::$dir . '../sample/sections/extensions/accordion.php'; |
@@ -546,46 +546,46 @@ discard block |
||
| 546 | 546 | * Raw README |
| 547 | 547 | */ |
| 548 | 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' => __DIR__ . '/../README.md', // FULL PATH, not relative, please. |
|
| 558 | - ), |
|
| 559 | - ), |
|
| 560 | - ); |
|
| 561 | - |
|
| 562 | - Redux::set_section( $opt_name, $section ); |
|
| 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' => __DIR__ . '/../README.md', // FULL PATH, not relative, please. |
|
| 558 | + ), |
|
| 559 | + ), |
|
| 560 | + ); |
|
| 561 | + |
|
| 562 | + Redux::set_section( $opt_name, $section ); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 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 | - ) |
|
| 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 | 589 | ); |
| 590 | 590 | |
| 591 | 591 | /* |
@@ -615,150 +615,150 @@ discard block |
||
| 615 | 615 | // add_filter('redux/options/' . $opt_name . '/sections', 'dynamic_section'); |
| 616 | 616 | // . |
| 617 | 617 | if ( ! function_exists( 'compiler_action' ) ) { |
| 618 | - /** |
|
| 619 | - * This is a test function that will let you see when the compiler hook occurs. |
|
| 620 | - * It only runs if a field's value has changed and compiler => true is set. |
|
| 621 | - * |
|
| 622 | - * @param array $options Options values. |
|
| 623 | - * @param string $css Compiler selector CSS values compiler => array( CSS SELECTORS ). |
|
| 624 | - * @param array $changed_values Any values that have changed since last save. |
|
| 625 | - */ |
|
| 626 | - function compiler_action( array $options, string $css, array $changed_values ) { |
|
| 627 | - echo '<h1>The compiler hook has run!</h1>'; |
|
| 628 | - echo '<pre>'; |
|
| 629 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions |
|
| 630 | - print_r( $changed_values ); // Values that have changed since the last save. |
|
| 631 | - // echo '<br/>'; |
|
| 632 | - // print_r($options); //Option values. |
|
| 633 | - // echo '<br/>'; |
|
| 634 | - // print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS ). |
|
| 635 | - echo '</pre>'; |
|
| 636 | - } |
|
| 618 | + /** |
|
| 619 | + * This is a test function that will let you see when the compiler hook occurs. |
|
| 620 | + * It only runs if a field's value has changed and compiler => true is set. |
|
| 621 | + * |
|
| 622 | + * @param array $options Options values. |
|
| 623 | + * @param string $css Compiler selector CSS values compiler => array( CSS SELECTORS ). |
|
| 624 | + * @param array $changed_values Any values that have changed since last save. |
|
| 625 | + */ |
|
| 626 | + function compiler_action( array $options, string $css, array $changed_values ) { |
|
| 627 | + echo '<h1>The compiler hook has run!</h1>'; |
|
| 628 | + echo '<pre>'; |
|
| 629 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions |
|
| 630 | + print_r( $changed_values ); // Values that have changed since the last save. |
|
| 631 | + // echo '<br/>'; |
|
| 632 | + // print_r($options); //Option values. |
|
| 633 | + // echo '<br/>'; |
|
| 634 | + // print_r($css); // Compiler selector CSS values compiler => array( CSS SELECTORS ). |
|
| 635 | + echo '</pre>'; |
|
| 636 | + } |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | if ( ! function_exists( 'redux_validate_callback_function' ) ) { |
| 640 | - /** |
|
| 641 | - * Custom function for the callback validation referenced above |
|
| 642 | - * |
|
| 643 | - * @param array $field Field array. |
|
| 644 | - * @param mixed $value New value. |
|
| 645 | - * @param mixed $existing_value Existing value. |
|
| 646 | - * |
|
| 647 | - * @return array |
|
| 648 | - */ |
|
| 649 | - function redux_validate_callback_function( array $field, $value, $existing_value ): array { |
|
| 650 | - $error = false; |
|
| 651 | - $warning = false; |
|
| 652 | - |
|
| 653 | - // Do your validation. |
|
| 654 | - if ( 1 === (int) $value ) { |
|
| 655 | - $error = true; |
|
| 656 | - $value = $existing_value; |
|
| 657 | - } elseif ( 2 === (int) $value ) { |
|
| 658 | - $warning = true; |
|
| 659 | - $value = $existing_value; |
|
| 660 | - } |
|
| 661 | - |
|
| 662 | - $return['value'] = $value; |
|
| 663 | - |
|
| 664 | - if ( true === $error ) { |
|
| 665 | - $field['msg'] = 'your custom error message'; |
|
| 666 | - $return['error'] = $field; |
|
| 667 | - } |
|
| 668 | - |
|
| 669 | - if ( true === $warning ) { |
|
| 670 | - $field['msg'] = 'your custom warning message'; |
|
| 671 | - $return['warning'] = $field; |
|
| 672 | - } |
|
| 673 | - |
|
| 674 | - return $return; |
|
| 675 | - } |
|
| 640 | + /** |
|
| 641 | + * Custom function for the callback validation referenced above |
|
| 642 | + * |
|
| 643 | + * @param array $field Field array. |
|
| 644 | + * @param mixed $value New value. |
|
| 645 | + * @param mixed $existing_value Existing value. |
|
| 646 | + * |
|
| 647 | + * @return array |
|
| 648 | + */ |
|
| 649 | + function redux_validate_callback_function( array $field, $value, $existing_value ): array { |
|
| 650 | + $error = false; |
|
| 651 | + $warning = false; |
|
| 652 | + |
|
| 653 | + // Do your validation. |
|
| 654 | + if ( 1 === (int) $value ) { |
|
| 655 | + $error = true; |
|
| 656 | + $value = $existing_value; |
|
| 657 | + } elseif ( 2 === (int) $value ) { |
|
| 658 | + $warning = true; |
|
| 659 | + $value = $existing_value; |
|
| 660 | + } |
|
| 661 | + |
|
| 662 | + $return['value'] = $value; |
|
| 663 | + |
|
| 664 | + if ( true === $error ) { |
|
| 665 | + $field['msg'] = 'your custom error message'; |
|
| 666 | + $return['error'] = $field; |
|
| 667 | + } |
|
| 668 | + |
|
| 669 | + if ( true === $warning ) { |
|
| 670 | + $field['msg'] = 'your custom warning message'; |
|
| 671 | + $return['warning'] = $field; |
|
| 672 | + } |
|
| 673 | + |
|
| 674 | + return $return; |
|
| 675 | + } |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | |
| 679 | 679 | if ( ! function_exists( 'dynamic_section' ) ) { |
| 680 | - /** |
|
| 681 | - * Custom function for filtering the section array. |
|
| 682 | - * Good for child themes to override or add to the sections. |
|
| 683 | - * Simply include this function in the child themes functions.php file. |
|
| 684 | - * NOTE: the defined constants for URLs and directories will NOT be available at this point in a child theme, |
|
| 685 | - * so you must use get_template_directory_uri() if you want to use any of the built-in icons. |
|
| 686 | - * |
|
| 687 | - * @param array $sections Section array. |
|
| 688 | - * |
|
| 689 | - * @return array |
|
| 690 | - */ |
|
| 691 | - function dynamic_section( array $sections ): array { |
|
| 692 | - $sections[] = array( |
|
| 693 | - 'title' => esc_html__( 'Section via hook', 'your-textdomain-here' ), |
|
| 694 | - '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>', |
|
| 695 | - 'icon' => 'el el-paper-clip', |
|
| 696 | - |
|
| 697 | - // Leave this as a blank section, no options just some intro text set above. |
|
| 698 | - 'fields' => array(), |
|
| 699 | - ); |
|
| 700 | - |
|
| 701 | - return $sections; |
|
| 702 | - } |
|
| 680 | + /** |
|
| 681 | + * Custom function for filtering the section array. |
|
| 682 | + * Good for child themes to override or add to the sections. |
|
| 683 | + * Simply include this function in the child themes functions.php file. |
|
| 684 | + * NOTE: the defined constants for URLs and directories will NOT be available at this point in a child theme, |
|
| 685 | + * so you must use get_template_directory_uri() if you want to use any of the built-in icons. |
|
| 686 | + * |
|
| 687 | + * @param array $sections Section array. |
|
| 688 | + * |
|
| 689 | + * @return array |
|
| 690 | + */ |
|
| 691 | + function dynamic_section( array $sections ): array { |
|
| 692 | + $sections[] = array( |
|
| 693 | + 'title' => esc_html__( 'Section via hook', 'your-textdomain-here' ), |
|
| 694 | + '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>', |
|
| 695 | + 'icon' => 'el el-paper-clip', |
|
| 696 | + |
|
| 697 | + // Leave this as a blank section, no options just some intro text set above. |
|
| 698 | + 'fields' => array(), |
|
| 699 | + ); |
|
| 700 | + |
|
| 701 | + return $sections; |
|
| 702 | + } |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if ( ! function_exists( 'change_arguments' ) ) { |
| 706 | - /** |
|
| 707 | - * Filter hook for filtering the args. |
|
| 708 | - * Good for child themes to override or add to the args array. |
|
| 709 | - * It can also be used in other functions. |
|
| 710 | - * |
|
| 711 | - * @param array $args Global arguments array. |
|
| 712 | - * |
|
| 713 | - * @return array |
|
| 714 | - */ |
|
| 715 | - function change_arguments( array $args ): array { |
|
| 716 | - $args['dev_mode'] = true; |
|
| 717 | - |
|
| 718 | - return $args; |
|
| 719 | - } |
|
| 706 | + /** |
|
| 707 | + * Filter hook for filtering the args. |
|
| 708 | + * Good for child themes to override or add to the args array. |
|
| 709 | + * It can also be used in other functions. |
|
| 710 | + * |
|
| 711 | + * @param array $args Global arguments array. |
|
| 712 | + * |
|
| 713 | + * @return array |
|
| 714 | + */ |
|
| 715 | + function change_arguments( array $args ): array { |
|
| 716 | + $args['dev_mode'] = true; |
|
| 717 | + |
|
| 718 | + return $args; |
|
| 719 | + } |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | if ( ! function_exists( 'change_defaults' ) ) { |
| 723 | - /** |
|
| 724 | - * Filter hook for filtering the default value of any given field. Very useful in development mode. |
|
| 725 | - * |
|
| 726 | - * @param array $defaults Default value array. |
|
| 727 | - * |
|
| 728 | - * @return array |
|
| 729 | - */ |
|
| 730 | - function change_defaults( array $defaults ): array { |
|
| 731 | - $defaults['str_replace'] = esc_html__( 'Testing filter hook!', 'your-textdomain-here' ); |
|
| 732 | - |
|
| 733 | - return $defaults; |
|
| 734 | - } |
|
| 723 | + /** |
|
| 724 | + * Filter hook for filtering the default value of any given field. Very useful in development mode. |
|
| 725 | + * |
|
| 726 | + * @param array $defaults Default value array. |
|
| 727 | + * |
|
| 728 | + * @return array |
|
| 729 | + */ |
|
| 730 | + function change_defaults( array $defaults ): array { |
|
| 731 | + $defaults['str_replace'] = esc_html__( 'Testing filter hook!', 'your-textdomain-here' ); |
|
| 732 | + |
|
| 733 | + return $defaults; |
|
| 734 | + } |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | if ( ! function_exists( 'redux_custom_sanitize' ) ) { |
| 738 | - /** |
|
| 739 | - * Function to be used if the field sanitizes argument. |
|
| 740 | - * Return value MUST be formatted or cleaned text to display. |
|
| 741 | - * |
|
| 742 | - * @param string $value Value to evaluate or clean. Required. |
|
| 743 | - * |
|
| 744 | - * @return string |
|
| 745 | - */ |
|
| 746 | - function redux_custom_sanitize( string $value ): string { |
|
| 747 | - $return = ''; |
|
| 748 | - |
|
| 749 | - foreach ( explode( ' ', $value ) as $w ) { |
|
| 750 | - foreach ( str_split( $w ) as $k => $v ) { |
|
| 751 | - if ( ( $k + 1 ) % 2 !== 0 && ctype_alpha( $v ) ) { |
|
| 752 | - $return .= mb_strtoupper( $v ); |
|
| 753 | - } else { |
|
| 754 | - $return .= $v; |
|
| 755 | - } |
|
| 756 | - } |
|
| 757 | - |
|
| 758 | - $return .= ' '; |
|
| 759 | - } |
|
| 760 | - |
|
| 761 | - return $return; |
|
| 762 | - } |
|
| 738 | + /** |
|
| 739 | + * Function to be used if the field sanitizes argument. |
|
| 740 | + * Return value MUST be formatted or cleaned text to display. |
|
| 741 | + * |
|
| 742 | + * @param string $value Value to evaluate or clean. Required. |
|
| 743 | + * |
|
| 744 | + * @return string |
|
| 745 | + */ |
|
| 746 | + function redux_custom_sanitize( string $value ): string { |
|
| 747 | + $return = ''; |
|
| 748 | + |
|
| 749 | + foreach ( explode( ' ', $value ) as $w ) { |
|
| 750 | + foreach ( str_split( $w ) as $k => $v ) { |
|
| 751 | + if ( ( $k + 1 ) % 2 !== 0 && ctype_alpha( $v ) ) { |
|
| 752 | + $return .= mb_strtoupper( $v ); |
|
| 753 | + } else { |
|
| 754 | + $return .= $v; |
|
| 755 | + } |
|
| 756 | + } |
|
| 757 | + |
|
| 758 | + $return .= ' '; |
|
| 759 | + } |
|
| 760 | + |
|
| 761 | + return $return; |
|
| 762 | + } |
|
| 763 | 763 | } |
| 764 | 764 | // phpcs:enable |