assets
4 years ago
butterbean
2 years ago
controls
3 years ago
gallery-metabox
1 year ago
metabox.php
2 years ago
shortcodes.php
6 years ago
metabox.php
1827 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Adds custom metabox |
| 4 | * |
| 5 | * @package Ocean_Extra |
| 6 | * @category Core |
| 7 | * @author OceanWP |
| 8 | */ |
| 9 | |
| 10 | // Exit if accessed directly |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit; |
| 13 | } |
| 14 | |
| 15 | // The Metabox class |
| 16 | if ( ! class_exists( 'OceanWP_Post_Metabox' ) ) { |
| 17 | |
| 18 | /** |
| 19 | * Main ButterBean class. Runs the show. |
| 20 | * |
| 21 | * @since 1.1.2 |
| 22 | * @access public |
| 23 | */ |
| 24 | final class OceanWP_Post_Metabox { |
| 25 | |
| 26 | private $post_types; |
| 27 | private $default_control; |
| 28 | private $custom_control; |
| 29 | |
| 30 | /** |
| 31 | * Register this class with the WordPress API |
| 32 | * |
| 33 | * @since 1.1.2 |
| 34 | */ |
| 35 | private function setup_actions() { |
| 36 | |
| 37 | // Capabilities |
| 38 | $capabilities = apply_filters( 'ocean_main_metaboxes_capabilities', 'manage_options' ); |
| 39 | |
| 40 | // Post types to add the metabox to |
| 41 | $this->post_types = apply_filters( 'ocean_main_metaboxes_post_types', array( |
| 42 | 'post', |
| 43 | 'page', |
| 44 | 'product', |
| 45 | 'oceanwp_library', |
| 46 | 'elementor_library', |
| 47 | 'ae_global_templates', |
| 48 | ) ); |
| 49 | |
| 50 | // Default butterbean controls |
| 51 | $this->default_control = array( |
| 52 | 'select', |
| 53 | 'color', |
| 54 | 'image', |
| 55 | 'text', |
| 56 | 'number', |
| 57 | 'textarea', |
| 58 | ); |
| 59 | |
| 60 | // Custom butterbean controls |
| 61 | $this->custom_control = array( |
| 62 | 'buttonset' => 'OceanWP_ButterBean_Control_Buttonset', |
| 63 | 'range' => 'OceanWP_ButterBean_Control_Range', |
| 64 | 'media' => 'OceanWP_ButterBean_Control_Media', |
| 65 | 'rgba-color' => 'OceanWP_ButterBean_Control_RGBA_Color', |
| 66 | 'multiple-select' => 'OceanWP_ButterBean_Control_Multiple_Select', |
| 67 | 'editor' => 'OceanWP_ButterBean_Control_Editor', |
| 68 | 'typography' => 'OceanWP_ButterBean_Control_Typography', |
| 69 | ); |
| 70 | |
| 71 | // Overwrite default controls |
| 72 | add_filter( 'butterbean_pre_control_template', array( $this, 'default_control_templates' ), 10, 2 ); |
| 73 | |
| 74 | // Register custom controls |
| 75 | add_filter( 'butterbean_control_template', array( $this, 'custom_control_templates' ), 10, 2 ); |
| 76 | |
| 77 | // Register new controls types |
| 78 | add_action( 'butterbean_register', array( $this, 'register_control_types' ), 10, 2 ); |
| 79 | |
| 80 | if ( current_user_can( $capabilities ) ) { |
| 81 | |
| 82 | // Register fields |
| 83 | add_action( 'butterbean_register', array( $this, 'register' ), 10, 2 ); |
| 84 | |
| 85 | // Register fields for the posts |
| 86 | add_action( 'butterbean_register', array( $this, 'posts_register' ), 10, 2 ); |
| 87 | |
| 88 | // Load scripts and styles. |
| 89 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| 90 | |
| 91 | } |
| 92 | |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * Load scripts and styles |
| 97 | * |
| 98 | * @since 1.1.2 |
| 99 | */ |
| 100 | public function enqueue_scripts( $hook ) { |
| 101 | |
| 102 | // Only needed on these admin screens |
| 103 | if ( $hook != 'post.php' && $hook != 'post-new.php' ) { |
| 104 | return; |
| 105 | } |
| 106 | |
| 107 | // Get global post |
| 108 | global $post; |
| 109 | |
| 110 | // Return if post is not object |
| 111 | if ( ! is_object( $post ) ) { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | // Post types scripts |
| 116 | $post_types_scripts = apply_filters( 'ocean_metaboxes_post_types_scripts', $this->post_types ); |
| 117 | |
| 118 | // Return if wrong post type |
| 119 | if ( ! in_array( $post->post_type, $post_types_scripts ) ) { |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | $min = ( SCRIPT_DEBUG ) ? '' : '.min'; |
| 124 | |
| 125 | global $current_screen; |
| 126 | |
| 127 | $mb_script = apply_filters( 'oceanwp_butterbean_metabox_assets', false ); |
| 128 | |
| 129 | if ( isset( $current_screen ) ) { |
| 130 | if ( property_exists( $current_screen, 'is_block_editor') ) { |
| 131 | if ( true === $current_screen->is_block_editor && false === $mb_script ) { |
| 132 | return; |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // Default style |
| 138 | wp_enqueue_style( 'oceanwp-butterbean', plugins_url( '/controls/assets/css/butterbean'. $min .'.css', __FILE__ ) ); |
| 139 | |
| 140 | // Default script. |
| 141 | wp_enqueue_script( 'oceanwp-butterbean', plugins_url( '/controls/assets/js/butterbean'. $min .'.js', __FILE__ ), array( 'butterbean' ), '', true ); |
| 142 | |
| 143 | // Metabox script |
| 144 | wp_enqueue_script( 'oceanwp-metabox-script', plugins_url( '/assets/js/metabox.min.js', __FILE__ ), array( 'jquery' ), OE_VERSION, true ); |
| 145 | |
| 146 | // Enqueue the select2 script, I use "oceanwp-select2" to avoid plugins conflicts |
| 147 | wp_enqueue_script( 'oceanwp-select2', plugins_url( '/controls/assets/js/select2.full.min.js', __FILE__ ), array( 'jquery' ), false, true ); |
| 148 | |
| 149 | // Enqueue the select2 style |
| 150 | wp_enqueue_style( 'select2', plugins_url( '/controls/assets/css/select2.min.css', __FILE__ ) ); |
| 151 | |
| 152 | // Enqueue color picker alpha |
| 153 | wp_enqueue_script( 'wp-color-picker-alpha', plugins_url( '/controls/assets/js/wp-color-picker-alpha.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); |
| 154 | |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Registers control types |
| 159 | * |
| 160 | * @since 1.2.4 |
| 161 | */ |
| 162 | public function register_control_types( $butterbean ) { |
| 163 | $controls = $this->custom_control; |
| 164 | |
| 165 | foreach ( $controls as $control => $class ) { |
| 166 | |
| 167 | require_once( OE_PATH . '/includes/metabox/controls/'. $control .'/class-control-'. $control .'.php' ); |
| 168 | $butterbean->register_control_type( $control, $class ); |
| 169 | |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Get custom control templates |
| 175 | * |
| 176 | * @since 1.2.4 |
| 177 | */ |
| 178 | public function default_control_templates( $located, $slug ) { |
| 179 | $controls = $this->default_control; |
| 180 | |
| 181 | foreach ( $controls as $control ) { |
| 182 | |
| 183 | if ( $slug === $control ) { |
| 184 | return OE_PATH . '/includes/metabox/controls/'. $control .'/template.php'; |
| 185 | } |
| 186 | |
| 187 | } |
| 188 | |
| 189 | return $located; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Get custom control templates |
| 194 | * |
| 195 | * @since 1.2.4 |
| 196 | */ |
| 197 | public function custom_control_templates( $located, $slug ) { |
| 198 | $controls = $this->custom_control; |
| 199 | |
| 200 | foreach ( $controls as $control => $class ) { |
| 201 | |
| 202 | if ( $slug === $control ) { |
| 203 | return OE_PATH . '/includes/metabox/controls/'. $control .'/template.php'; |
| 204 | } |
| 205 | |
| 206 | } |
| 207 | |
| 208 | return $located; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Registration callback |
| 213 | * |
| 214 | * @since 1.1.2 |
| 215 | */ |
| 216 | public function register( $butterbean, $post_type ) { |
| 217 | |
| 218 | // Post types to add the metabox to |
| 219 | $post_types = $this->post_types; |
| 220 | |
| 221 | // Theme branding |
| 222 | if ( function_exists( 'oceanwp_theme_branding' ) ) { |
| 223 | $brand = oceanwp_theme_branding(); |
| 224 | } else { |
| 225 | $brand = 'OceanWP'; |
| 226 | } |
| 227 | |
| 228 | // Register managers, sections, controls, and settings here. |
| 229 | $butterbean->register_manager( |
| 230 | 'oceanwp_mb_settings', |
| 231 | array( |
| 232 | 'label' => $brand . ' ' . esc_html__( 'Settings', 'ocean-extra' ), |
| 233 | 'post_type' => $post_types, |
| 234 | 'context' => 'normal', |
| 235 | 'priority' => 'high' |
| 236 | ) |
| 237 | ); |
| 238 | |
| 239 | $manager = $butterbean->get_manager( 'oceanwp_mb_settings' ); |
| 240 | |
| 241 | $manager->register_section( |
| 242 | 'oceanwp_mb_main', |
| 243 | array( |
| 244 | 'label' => esc_html__( 'Main', 'ocean-extra' ), |
| 245 | 'icon' => 'dashicons-admin-generic' |
| 246 | ) |
| 247 | ); |
| 248 | |
| 249 | $manager->register_control( |
| 250 | 'ocean_post_layout', // Same as setting name. |
| 251 | array( |
| 252 | 'section' => 'oceanwp_mb_main', |
| 253 | 'type' => 'select', |
| 254 | 'label' => esc_html__( 'Content Layout', 'ocean-extra' ), |
| 255 | 'description' => esc_html__( 'Select your custom layout.', 'ocean-extra' ), |
| 256 | 'choices' => array( |
| 257 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 258 | 'right-sidebar' => esc_html__( 'Right Sidebar', 'ocean-extra' ), |
| 259 | 'left-sidebar' => esc_html__( 'Left Sidebar', 'ocean-extra' ), |
| 260 | 'full-width' => esc_html__( 'Full Width', 'ocean-extra' ), |
| 261 | 'full-screen' => esc_html__( '100% Full Width', 'ocean-extra' ), |
| 262 | 'both-sidebars' => esc_html__( 'Both Sidebars', 'ocean-extra' ), |
| 263 | ), |
| 264 | ) |
| 265 | ); |
| 266 | |
| 267 | $manager->register_setting( |
| 268 | 'ocean_post_layout', // Same as control name. |
| 269 | array( |
| 270 | 'sanitize_callback' => 'sanitize_key', |
| 271 | ) |
| 272 | ); |
| 273 | |
| 274 | $manager->register_control( |
| 275 | 'ocean_both_sidebars_style', // Same as setting name. |
| 276 | array( |
| 277 | 'section' => 'oceanwp_mb_main', |
| 278 | 'type' => 'select', |
| 279 | 'label' => esc_html__( 'Both Sidebars: Style', 'ocean-extra' ), |
| 280 | 'description' => esc_html__( 'Select your both sidebars style.', 'ocean-extra' ), |
| 281 | 'choices' => array( |
| 282 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 283 | 'ssc-style' => esc_html__( 'Sidebar / Sidebar / Content', 'ocean-extra' ), |
| 284 | 'scs-style' => esc_html__( 'Sidebar / Content / Sidebar', 'ocean-extra' ), |
| 285 | 'css-style' => esc_html__( 'Content / Sidebar / Sidebar', 'ocean-extra' ), |
| 286 | ), |
| 287 | ) |
| 288 | ); |
| 289 | |
| 290 | $manager->register_setting( |
| 291 | 'ocean_both_sidebars_style', // Same as control name. |
| 292 | array( |
| 293 | 'sanitize_callback' => 'sanitize_key', |
| 294 | ) |
| 295 | ); |
| 296 | |
| 297 | $manager->register_control( |
| 298 | 'ocean_both_sidebars_content_width', // Same as setting name. |
| 299 | array( |
| 300 | 'section' => 'oceanwp_mb_main', |
| 301 | 'type' => 'number', |
| 302 | 'label' => esc_html__( 'Both Sidebars: Content Width (%)', 'ocean-extra' ), |
| 303 | 'description' => esc_html__( 'Enter for custom content width.', 'ocean-extra' ), |
| 304 | 'attr' => array( |
| 305 | 'min' => '0', |
| 306 | 'step' => '1', |
| 307 | ), |
| 308 | ) |
| 309 | ); |
| 310 | |
| 311 | $manager->register_setting( |
| 312 | 'ocean_both_sidebars_content_width', // Same as control name. |
| 313 | array( |
| 314 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 315 | ) |
| 316 | ); |
| 317 | |
| 318 | $manager->register_control( |
| 319 | 'ocean_both_sidebars_sidebars_width', // Same as setting name. |
| 320 | array( |
| 321 | 'section' => 'oceanwp_mb_main', |
| 322 | 'type' => 'number', |
| 323 | 'label' => esc_html__( 'Both Sidebars: Sidebars Width (%)', 'ocean-extra' ), |
| 324 | 'description' => esc_html__( 'Enter for custom sidebars width.', 'ocean-extra' ), |
| 325 | 'attr' => array( |
| 326 | 'min' => '0', |
| 327 | 'step' => '1', |
| 328 | ), |
| 329 | ) |
| 330 | ); |
| 331 | |
| 332 | $manager->register_setting( |
| 333 | 'ocean_both_sidebars_sidebars_width', // Same as control name. |
| 334 | array( |
| 335 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 336 | ) |
| 337 | ); |
| 338 | |
| 339 | $manager->register_control( |
| 340 | 'ocean_sidebar', // Same as setting name. |
| 341 | array( |
| 342 | 'section' => 'oceanwp_mb_main', |
| 343 | 'type' => 'select', |
| 344 | 'label' => esc_html__( 'Sidebar', 'ocean-extra' ), |
| 345 | 'description' => esc_html__( 'Select your custom sidebar.', 'ocean-extra' ), |
| 346 | 'choices' => $this->helpers( 'widget_areas' ), |
| 347 | ) |
| 348 | ); |
| 349 | |
| 350 | $manager->register_setting( |
| 351 | 'ocean_sidebar', // Same as control name. |
| 352 | array( |
| 353 | 'sanitize_callback' => 'sanitize_key', |
| 354 | ) |
| 355 | ); |
| 356 | |
| 357 | $manager->register_control( |
| 358 | 'ocean_second_sidebar', // Same as setting name. |
| 359 | array( |
| 360 | 'section' => 'oceanwp_mb_main', |
| 361 | 'type' => 'select', |
| 362 | 'label' => esc_html__( 'Second Sidebar', 'ocean-extra' ), |
| 363 | 'description' => esc_html__( 'Select your custom second sidebar.', 'ocean-extra' ), |
| 364 | 'choices' => $this->helpers( 'widget_areas' ), |
| 365 | ) |
| 366 | ); |
| 367 | |
| 368 | $manager->register_setting( |
| 369 | 'ocean_second_sidebar', // Same as control name. |
| 370 | array( |
| 371 | 'sanitize_callback' => 'sanitize_key', |
| 372 | ) |
| 373 | ); |
| 374 | |
| 375 | $manager->register_control( |
| 376 | 'ocean_disable_margins', // Same as setting name. |
| 377 | array( |
| 378 | 'section' => 'oceanwp_mb_main', |
| 379 | 'type' => 'buttonset', |
| 380 | 'label' => esc_html__( 'Paddings', 'ocean-extra' ), |
| 381 | 'description' => esc_html__( 'Enable or disable the padding top and bottom.', 'ocean-extra' ), |
| 382 | 'choices' => array( |
| 383 | 'enable' => esc_html__( 'Enable', 'ocean-extra' ), |
| 384 | 'on' => esc_html__( 'Disable', 'ocean-extra' ), |
| 385 | ), |
| 386 | ) |
| 387 | ); |
| 388 | |
| 389 | $manager->register_setting( |
| 390 | 'ocean_disable_margins', // Same as control name. |
| 391 | array( |
| 392 | 'sanitize_callback' => 'sanitize_key', |
| 393 | 'default' => 'enable', |
| 394 | ) |
| 395 | ); |
| 396 | |
| 397 | $manager->register_control( |
| 398 | 'ocean_add_body_class', // Same as setting name. |
| 399 | array( |
| 400 | 'section' => 'oceanwp_mb_main', |
| 401 | 'type' => 'text', |
| 402 | 'label' => esc_html__( 'Custom Body Class', 'ocean-extra' ), |
| 403 | 'description' => esc_html__( 'Use space (space tab) to separate multiple classes. Do not use dots (.) or commas (,) to separate classes. Correct example: class-1 class-2 new-class-3', 'ocean-extra' ), |
| 404 | ) |
| 405 | ); |
| 406 | |
| 407 | $manager->register_setting( |
| 408 | 'ocean_add_body_class', // Same as control name. |
| 409 | array( |
| 410 | 'sanitize_callback' => 'sanitize_text_field', |
| 411 | ) |
| 412 | ); |
| 413 | |
| 414 | $manager->register_section( |
| 415 | 'oceanwp_mb_shortcodes', |
| 416 | array( |
| 417 | 'label' => esc_html__( 'Shortcodes', 'ocean-extra' ), |
| 418 | 'icon' => 'dashicons-editor-code' |
| 419 | ) |
| 420 | ); |
| 421 | |
| 422 | $manager->register_control( |
| 423 | 'ocean_shortcode_before_top_bar', // Same as setting name. |
| 424 | array( |
| 425 | 'section' => 'oceanwp_mb_shortcodes', |
| 426 | 'type' => 'text', |
| 427 | 'label' => esc_html__( 'Shortcode Before Top Bar', 'ocean-extra' ), |
| 428 | 'description' => esc_html__( 'Add your shortcode to be displayed before the top bar.', 'ocean-extra' ), |
| 429 | ) |
| 430 | ); |
| 431 | |
| 432 | $manager->register_setting( |
| 433 | 'ocean_shortcode_before_top_bar', // Same as control name. |
| 434 | array( |
| 435 | 'sanitize_callback' => 'sanitize_text_field', |
| 436 | ) |
| 437 | ); |
| 438 | |
| 439 | $manager->register_control( |
| 440 | 'ocean_shortcode_after_top_bar', // Same as setting name. |
| 441 | array( |
| 442 | 'section' => 'oceanwp_mb_shortcodes', |
| 443 | 'type' => 'text', |
| 444 | 'label' => esc_html__( 'Shortcode After Top Bar', 'ocean-extra' ), |
| 445 | 'description' => esc_html__( 'Add your shortcode to be displayed after the top bar.', 'ocean-extra' ), |
| 446 | ) |
| 447 | ); |
| 448 | |
| 449 | $manager->register_setting( |
| 450 | 'ocean_shortcode_after_top_bar', // Same as control name. |
| 451 | array( |
| 452 | 'sanitize_callback' => 'sanitize_text_field', |
| 453 | ) |
| 454 | ); |
| 455 | |
| 456 | $manager->register_control( |
| 457 | 'ocean_shortcode_before_header', // Same as setting name. |
| 458 | array( |
| 459 | 'section' => 'oceanwp_mb_shortcodes', |
| 460 | 'type' => 'text', |
| 461 | 'label' => esc_html__( 'Shortcode Before Header', 'ocean-extra' ), |
| 462 | 'description' => esc_html__( 'Add your shortcode to be displayed before the header.', 'ocean-extra' ), |
| 463 | ) |
| 464 | ); |
| 465 | |
| 466 | $manager->register_setting( |
| 467 | 'ocean_shortcode_before_header', // Same as control name. |
| 468 | array( |
| 469 | 'sanitize_callback' => 'sanitize_text_field', |
| 470 | ) |
| 471 | ); |
| 472 | |
| 473 | $manager->register_control( |
| 474 | 'ocean_shortcode_after_header', // Same as setting name. |
| 475 | array( |
| 476 | 'section' => 'oceanwp_mb_shortcodes', |
| 477 | 'type' => 'text', |
| 478 | 'label' => esc_html__( 'Shortcode After Header', 'ocean-extra' ), |
| 479 | 'description' => esc_html__( 'Add your shortcode to be displayed after the header.', 'ocean-extra' ), |
| 480 | ) |
| 481 | ); |
| 482 | |
| 483 | $manager->register_setting( |
| 484 | 'ocean_shortcode_after_header', // Same as control name. |
| 485 | array( |
| 486 | 'sanitize_callback' => 'sanitize_text_field', |
| 487 | ) |
| 488 | ); |
| 489 | |
| 490 | $manager->register_control( |
| 491 | 'ocean_has_shortcode', // Same as setting name. |
| 492 | array( |
| 493 | 'section' => 'oceanwp_mb_shortcodes', |
| 494 | 'type' => 'text', |
| 495 | 'label' => esc_html__( 'Shortcode Before Title', 'ocean-extra' ), |
| 496 | 'description' => esc_html__( 'Add your shortcode to be displayed before the page title.', 'ocean-extra' ), |
| 497 | ) |
| 498 | ); |
| 499 | |
| 500 | $manager->register_setting( |
| 501 | 'ocean_has_shortcode', // Same as control name. |
| 502 | array( |
| 503 | 'sanitize_callback' => 'sanitize_text_field', |
| 504 | ) |
| 505 | ); |
| 506 | |
| 507 | $manager->register_control( |
| 508 | 'ocean_shortcode_after_title', // Same as setting name. |
| 509 | array( |
| 510 | 'section' => 'oceanwp_mb_shortcodes', |
| 511 | 'type' => 'text', |
| 512 | 'label' => esc_html__( 'Shortcode After Title', 'ocean-extra' ), |
| 513 | 'description' => esc_html__( 'Add your shortcode to be displayed after the page title.', 'ocean-extra' ), |
| 514 | ) |
| 515 | ); |
| 516 | |
| 517 | $manager->register_setting( |
| 518 | 'ocean_shortcode_after_title', // Same as control name. |
| 519 | array( |
| 520 | 'sanitize_callback' => 'sanitize_text_field', |
| 521 | ) |
| 522 | ); |
| 523 | |
| 524 | $manager->register_control( |
| 525 | 'ocean_shortcode_before_footer_widgets', // Same as setting name. |
| 526 | array( |
| 527 | 'section' => 'oceanwp_mb_shortcodes', |
| 528 | 'type' => 'text', |
| 529 | 'label' => esc_html__( 'Shortcode Before Footer Widgets', 'ocean-extra' ), |
| 530 | 'description' => esc_html__( 'Add your shortcode to be displayed before the footer widgets.', 'ocean-extra' ), |
| 531 | ) |
| 532 | ); |
| 533 | |
| 534 | $manager->register_setting( |
| 535 | 'ocean_shortcode_before_footer_widgets', // Same as control name. |
| 536 | array( |
| 537 | 'sanitize_callback' => 'sanitize_text_field', |
| 538 | ) |
| 539 | ); |
| 540 | |
| 541 | $manager->register_control( |
| 542 | 'ocean_shortcode_after_footer_widgets', // Same as setting name. |
| 543 | array( |
| 544 | 'section' => 'oceanwp_mb_shortcodes', |
| 545 | 'type' => 'text', |
| 546 | 'label' => esc_html__( 'Shortcode After Footer Widgets', 'ocean-extra' ), |
| 547 | 'description' => esc_html__( 'Add your shortcode to be displayed after the footer widgets.', 'ocean-extra' ), |
| 548 | ) |
| 549 | ); |
| 550 | |
| 551 | $manager->register_setting( |
| 552 | 'ocean_shortcode_after_footer_widgets', // Same as control name. |
| 553 | array( |
| 554 | 'sanitize_callback' => 'sanitize_text_field', |
| 555 | ) |
| 556 | ); |
| 557 | |
| 558 | $manager->register_control( |
| 559 | 'ocean_shortcode_before_footer_bottom', // Same as setting name. |
| 560 | array( |
| 561 | 'section' => 'oceanwp_mb_shortcodes', |
| 562 | 'type' => 'text', |
| 563 | 'label' => esc_html__( 'Shortcode Before Footer Bottom', 'ocean-extra' ), |
| 564 | 'description' => esc_html__( 'Add your shortcode to be displayed before the footer bottom.', 'ocean-extra' ), |
| 565 | ) |
| 566 | ); |
| 567 | |
| 568 | $manager->register_setting( |
| 569 | 'ocean_shortcode_before_footer_bottom', // Same as control name. |
| 570 | array( |
| 571 | 'sanitize_callback' => 'sanitize_text_field', |
| 572 | ) |
| 573 | ); |
| 574 | |
| 575 | $manager->register_control( |
| 576 | 'ocean_shortcode_after_footer_bottom', // Same as setting name. |
| 577 | array( |
| 578 | 'section' => 'oceanwp_mb_shortcodes', |
| 579 | 'type' => 'text', |
| 580 | 'label' => esc_html__( 'Shortcode After Footer Bottom', 'ocean-extra' ), |
| 581 | 'description' => esc_html__( 'Add your shortcode to be displayed after the footer bottom.', 'ocean-extra' ), |
| 582 | ) |
| 583 | ); |
| 584 | |
| 585 | $manager->register_setting( |
| 586 | 'ocean_shortcode_after_footer_bottom', // Same as control name. |
| 587 | array( |
| 588 | 'sanitize_callback' => 'sanitize_text_field', |
| 589 | ) |
| 590 | ); |
| 591 | |
| 592 | $manager->register_section( |
| 593 | 'oceanwp_mb_header', |
| 594 | array( |
| 595 | 'label' => esc_html__( 'Header', 'ocean-extra' ), |
| 596 | 'icon' => 'dashicons-sticky' |
| 597 | ) |
| 598 | ); |
| 599 | |
| 600 | $manager->register_control( |
| 601 | 'ocean_display_top_bar', // Same as setting name. |
| 602 | array( |
| 603 | 'section' => 'oceanwp_mb_header', |
| 604 | 'type' => 'buttonset', |
| 605 | 'label' => esc_html__( 'Display Top Bar', 'ocean-extra' ), |
| 606 | 'description' => esc_html__( 'Enable or disable the top bar.', 'ocean-extra' ), |
| 607 | 'choices' => array( |
| 608 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 609 | 'on' => esc_html__( 'Enable', 'ocean-extra' ), |
| 610 | 'off' => esc_html__( 'Disable', 'ocean-extra' ), |
| 611 | ), |
| 612 | ) |
| 613 | ); |
| 614 | |
| 615 | $manager->register_setting( |
| 616 | 'ocean_display_top_bar', // Same as control name. |
| 617 | array( |
| 618 | 'sanitize_callback' => 'sanitize_key', |
| 619 | 'default' => 'default', |
| 620 | ) |
| 621 | ); |
| 622 | |
| 623 | $manager->register_control( |
| 624 | 'ocean_display_header', // Same as setting name. |
| 625 | array( |
| 626 | 'section' => 'oceanwp_mb_header', |
| 627 | 'type' => 'buttonset', |
| 628 | 'label' => esc_html__( 'Display Header', 'ocean-extra' ), |
| 629 | 'description' => esc_html__( 'Enable or disable the header.', 'ocean-extra' ), |
| 630 | 'choices' => array( |
| 631 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 632 | 'on' => esc_html__( 'Enable', 'ocean-extra' ), |
| 633 | 'off' => esc_html__( 'Disable', 'ocean-extra' ), |
| 634 | ), |
| 635 | ) |
| 636 | ); |
| 637 | |
| 638 | $manager->register_setting( |
| 639 | 'ocean_display_header', // Same as control name. |
| 640 | array( |
| 641 | 'sanitize_callback' => 'sanitize_key', |
| 642 | 'default' => 'default', |
| 643 | ) |
| 644 | ); |
| 645 | |
| 646 | $manager->register_control( |
| 647 | 'ocean_header_style', // Same as setting name. |
| 648 | array( |
| 649 | 'section' => 'oceanwp_mb_header', |
| 650 | 'type' => 'select', |
| 651 | 'label' => esc_html__( 'Header Style', 'ocean-extra' ), |
| 652 | 'description' => esc_html__( 'Choose which header style to display on this page.', 'ocean-extra' ), |
| 653 | 'choices' => array( |
| 654 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 655 | 'minimal' => esc_html__( 'Minimal', 'ocean-extra' ), |
| 656 | 'transparent' => esc_html__( 'Transparent', 'ocean-extra' ), |
| 657 | 'top' => esc_html__( 'Top Menu', 'ocean-extra' ), |
| 658 | 'full_screen' => esc_html__( 'Full Screen', 'ocean-extra' ), |
| 659 | 'center' => esc_html__( 'Center', 'ocean-extra' ), |
| 660 | 'medium' => esc_html__( 'Medium', 'ocean-extra' ), |
| 661 | 'vertical' => esc_html__( 'Vertical', 'ocean-extra' ), |
| 662 | 'custom' => esc_html__( 'Custom Header', 'ocean-extra' ), |
| 663 | ), |
| 664 | ) |
| 665 | ); |
| 666 | |
| 667 | $manager->register_setting( |
| 668 | 'ocean_header_style', // Same as control name. |
| 669 | array( |
| 670 | 'sanitize_callback' => 'sanitize_key', |
| 671 | ) |
| 672 | ); |
| 673 | |
| 674 | $manager->register_control( |
| 675 | 'ocean_center_header_left_menu', // Same as setting name. |
| 676 | array( |
| 677 | 'section' => 'oceanwp_mb_header', |
| 678 | 'type' => 'select', |
| 679 | 'label' => esc_html__( 'Left Menu', 'ocean-extra' ), |
| 680 | 'description' => esc_html__( 'Choose which left menu to display on this page/post.', 'ocean-extra' ), |
| 681 | 'choices' => $this->helpers( 'menus' ), |
| 682 | ) |
| 683 | ); |
| 684 | |
| 685 | $manager->register_setting( |
| 686 | 'ocean_center_header_left_menu', // Same as control name. |
| 687 | array( |
| 688 | 'sanitize_callback' => 'sanitize_key', |
| 689 | ) |
| 690 | ); |
| 691 | |
| 692 | $manager->register_control( |
| 693 | 'ocean_custom_header_template', // Same as setting name. |
| 694 | array( |
| 695 | 'section' => 'oceanwp_mb_header', |
| 696 | 'type' => 'select', |
| 697 | 'label' => esc_html__( 'Select Template', 'ocean-extra' ), |
| 698 | 'description' => esc_html__( 'Choose a template created in Theme Panel > My Library.', 'ocean-extra' ), |
| 699 | 'choices' => $this->helpers( 'library' ), |
| 700 | ) |
| 701 | ); |
| 702 | |
| 703 | $manager->register_setting( |
| 704 | 'ocean_custom_header_template', // Same as control name. |
| 705 | array( |
| 706 | 'sanitize_callback' => 'sanitize_key', |
| 707 | ) |
| 708 | ); |
| 709 | |
| 710 | $manager->register_section( |
| 711 | 'oceanwp_mb_logo', |
| 712 | array( |
| 713 | 'label' => esc_html__( 'Logo', 'ocean-extra' ), |
| 714 | 'icon' => 'dashicons-format-image' |
| 715 | ) |
| 716 | ); |
| 717 | |
| 718 | $manager->register_control( |
| 719 | 'ocean_custom_logo', // Same as setting name. |
| 720 | array( |
| 721 | 'section' => 'oceanwp_mb_logo', |
| 722 | 'type' => 'image', |
| 723 | 'label' => esc_html__( 'Logo', 'ocean-extra' ), |
| 724 | 'description' => esc_html__( 'Select a custom logo on this page/post.', 'ocean-extra' ), |
| 725 | ) |
| 726 | ); |
| 727 | |
| 728 | $manager->register_setting( |
| 729 | 'ocean_custom_logo', // Same as control name. |
| 730 | array( |
| 731 | 'sanitize_callback' => 'sanitize_key', |
| 732 | ) |
| 733 | ); |
| 734 | |
| 735 | $manager->register_control( |
| 736 | 'ocean_custom_retina_logo', // Same as setting name. |
| 737 | array( |
| 738 | 'section' => 'oceanwp_mb_logo', |
| 739 | 'type' => 'image', |
| 740 | 'label' => esc_html__( 'Retina Logo', 'ocean-extra' ), |
| 741 | 'description' => esc_html__( 'Select a custom retina logo on this page/post.', 'ocean-extra' ), |
| 742 | ) |
| 743 | ); |
| 744 | |
| 745 | $manager->register_setting( |
| 746 | 'ocean_custom_retina_logo', // Same as control name. |
| 747 | array( |
| 748 | 'sanitize_callback' => 'sanitize_key', |
| 749 | ) |
| 750 | ); |
| 751 | |
| 752 | $manager->register_control( |
| 753 | 'ocean_custom_logo_max_width', // Same as setting name. |
| 754 | array( |
| 755 | 'section' => 'oceanwp_mb_logo', |
| 756 | 'type' => 'number', |
| 757 | 'label' => esc_html__( 'Max Width (px)', 'ocean-extra' ), |
| 758 | 'description' => esc_html__( 'Enter a custom max width for this page/post.', 'ocean-extra' ), |
| 759 | 'attr' => array( |
| 760 | 'min' => '0', |
| 761 | 'step' => '1', |
| 762 | ), |
| 763 | ) |
| 764 | ); |
| 765 | |
| 766 | $manager->register_setting( |
| 767 | 'ocean_custom_logo_max_width', // Same as control name. |
| 768 | array( |
| 769 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 770 | ) |
| 771 | ); |
| 772 | |
| 773 | $manager->register_control( |
| 774 | 'ocean_custom_logo_tablet_max_width', // Same as setting name. |
| 775 | array( |
| 776 | 'section' => 'oceanwp_mb_logo', |
| 777 | 'type' => 'number', |
| 778 | 'label' => esc_html__( 'Tablet: Max Width (px)', 'ocean-extra' ), |
| 779 | 'description' => esc_html__( 'Enter a custom max width for tablet view on this page/post.', 'ocean-extra' ), |
| 780 | 'attr' => array( |
| 781 | 'min' => '0', |
| 782 | 'step' => '1', |
| 783 | ), |
| 784 | ) |
| 785 | ); |
| 786 | |
| 787 | $manager->register_setting( |
| 788 | 'ocean_custom_logo_tablet_max_width', // Same as control name. |
| 789 | array( |
| 790 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 791 | ) |
| 792 | ); |
| 793 | |
| 794 | $manager->register_control( |
| 795 | 'ocean_custom_logo_mobile_max_width', // Same as setting name. |
| 796 | array( |
| 797 | 'section' => 'oceanwp_mb_logo', |
| 798 | 'type' => 'number', |
| 799 | 'label' => esc_html__( 'Mobile: Max Width (px)', 'ocean-extra' ), |
| 800 | 'description' => esc_html__( 'Enter a custom max width for mobile view on this page/post.', 'ocean-extra' ), |
| 801 | 'attr' => array( |
| 802 | 'min' => '0', |
| 803 | 'step' => '1', |
| 804 | ), |
| 805 | ) |
| 806 | ); |
| 807 | |
| 808 | $manager->register_setting( |
| 809 | 'ocean_custom_logo_mobile_max_width', // Same as control name. |
| 810 | array( |
| 811 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 812 | ) |
| 813 | ); |
| 814 | |
| 815 | $manager->register_control( |
| 816 | 'ocean_custom_logo_max_height', // Same as setting name. |
| 817 | array( |
| 818 | 'section' => 'oceanwp_mb_logo', |
| 819 | 'type' => 'number', |
| 820 | 'label' => esc_html__( 'Max Height (px)', 'ocean-extra' ), |
| 821 | 'description' => esc_html__( 'Enter a custom max height for this page/post.', 'ocean-extra' ), |
| 822 | 'attr' => array( |
| 823 | 'min' => '0', |
| 824 | 'step' => '1', |
| 825 | ), |
| 826 | ) |
| 827 | ); |
| 828 | |
| 829 | $manager->register_setting( |
| 830 | 'ocean_custom_logo_max_height', // Same as control name. |
| 831 | array( |
| 832 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 833 | ) |
| 834 | ); |
| 835 | |
| 836 | $manager->register_control( |
| 837 | 'ocean_custom_logo_tablet_max_height', // Same as setting name. |
| 838 | array( |
| 839 | 'section' => 'oceanwp_mb_logo', |
| 840 | 'type' => 'number', |
| 841 | 'label' => esc_html__( 'Tablet: Max Height (px)', 'ocean-extra' ), |
| 842 | 'description' => esc_html__( 'Enter a custom max height for tablet view on this page/post.', 'ocean-extra' ), |
| 843 | 'attr' => array( |
| 844 | 'min' => '0', |
| 845 | 'step' => '1', |
| 846 | ), |
| 847 | ) |
| 848 | ); |
| 849 | |
| 850 | $manager->register_setting( |
| 851 | 'ocean_custom_logo_tablet_max_height', // Same as control name. |
| 852 | array( |
| 853 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 854 | ) |
| 855 | ); |
| 856 | |
| 857 | $manager->register_control( |
| 858 | 'ocean_custom_logo_mobile_max_height', // Same as setting name. |
| 859 | array( |
| 860 | 'section' => 'oceanwp_mb_logo', |
| 861 | 'type' => 'number', |
| 862 | 'label' => esc_html__( 'Mobile: Max Height (px)', 'ocean-extra' ), |
| 863 | 'description' => esc_html__( 'Enter a custom max height for mobile view on this page/post.', 'ocean-extra' ), |
| 864 | 'attr' => array( |
| 865 | 'min' => '0', |
| 866 | 'step' => '1', |
| 867 | ), |
| 868 | ) |
| 869 | ); |
| 870 | |
| 871 | $manager->register_setting( |
| 872 | 'ocean_custom_logo_mobile_max_height', // Same as control name. |
| 873 | array( |
| 874 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 875 | ) |
| 876 | ); |
| 877 | |
| 878 | $manager->register_section( |
| 879 | 'oceanwp_mb_menu', |
| 880 | array( |
| 881 | 'label' => esc_html__( 'Menu', 'ocean-extra' ), |
| 882 | 'icon' => 'dashicons-menu' |
| 883 | ) |
| 884 | ); |
| 885 | |
| 886 | $manager->register_control( |
| 887 | 'ocean_header_custom_menu', // Same as setting name. |
| 888 | array( |
| 889 | 'section' => 'oceanwp_mb_menu', |
| 890 | 'type' => 'select', |
| 891 | 'label' => esc_html__( 'Main Navigation Menu', 'ocean-extra' ), |
| 892 | 'description' => esc_html__( 'Choose which menu to display on this page/post.', 'ocean-extra' ), |
| 893 | 'choices' => $this->helpers( 'menus' ), |
| 894 | ) |
| 895 | ); |
| 896 | |
| 897 | $manager->register_setting( |
| 898 | 'ocean_header_custom_menu', // Same as control name. |
| 899 | array( |
| 900 | 'sanitize_callback' => 'sanitize_key', |
| 901 | ) |
| 902 | ); |
| 903 | |
| 904 | $manager->register_control( |
| 905 | 'ocean_menu_typo', // Same as setting name. |
| 906 | array( |
| 907 | 'section' => 'oceanwp_mb_menu', |
| 908 | 'type' => 'typography', |
| 909 | 'label' => esc_html__( 'Typography', 'ocean-extra' ), |
| 910 | 'description' => esc_html__( 'Typography for the menu.', 'ocean-extra' ), |
| 911 | 'settings' => array( |
| 912 | 'family' => 'ocean_menu_typo_font_family', |
| 913 | 'size' => 'ocean_menu_typo_font_size', |
| 914 | 'weight' => 'ocean_menu_typo_font_weight', |
| 915 | 'style' => 'ocean_menu_typo_font_style', |
| 916 | 'transform' => 'ocean_menu_typo_transform', |
| 917 | 'line_height' => 'ocean_menu_typo_line_height', |
| 918 | 'spacing' => 'ocean_menu_typo_spacing' |
| 919 | ), |
| 920 | 'l10n' => array(), |
| 921 | ) |
| 922 | ); |
| 923 | |
| 924 | $manager->register_setting( 'ocean_menu_typo_font_family', array( 'sanitize_callback' => 'sanitize_text_field', ) ); |
| 925 | $manager->register_setting( 'ocean_menu_typo_font_size', array( 'sanitize_callback' => 'sanitize_text_field', ) ); |
| 926 | $manager->register_setting( 'ocean_menu_typo_font_weight', array( 'sanitize_callback' => 'sanitize_key', ) ); |
| 927 | $manager->register_setting( 'ocean_menu_typo_font_style', array( 'sanitize_callback' => 'sanitize_key', ) ); |
| 928 | $manager->register_setting( 'ocean_menu_typo_transform', array( 'sanitize_callback' => 'sanitize_key', ) ); |
| 929 | $manager->register_setting( 'ocean_menu_typo_line_height', array( 'sanitize_callback' => 'sanitize_text_field', ) ); |
| 930 | $manager->register_setting( 'ocean_menu_typo_spacing', array( 'sanitize_callback' => 'sanitize_text_field', ) ); |
| 931 | |
| 932 | $manager->register_control( |
| 933 | 'ocean_menu_link_color', // Same as setting name. |
| 934 | array( |
| 935 | 'section' => 'oceanwp_mb_menu', |
| 936 | 'type' => 'rgba-color', |
| 937 | 'label' => esc_html__( 'Link Color', 'ocean-extra' ), |
| 938 | 'description' => esc_html__( 'Select a color. Hex code, ex: #555', 'ocean-extra' ), |
| 939 | ) |
| 940 | ); |
| 941 | |
| 942 | $manager->register_setting( |
| 943 | 'ocean_menu_link_color', // Same as control name. |
| 944 | array( |
| 945 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 946 | ) |
| 947 | ); |
| 948 | |
| 949 | $manager->register_control( |
| 950 | 'ocean_menu_link_color_hover', // Same as setting name. |
| 951 | array( |
| 952 | 'section' => 'oceanwp_mb_menu', |
| 953 | 'type' => 'rgba-color', |
| 954 | 'label' => esc_html__( 'Link Color: Hover', 'ocean-extra' ), |
| 955 | 'description' => esc_html__( 'Select a color. Hex code, ex: #13aff0', 'ocean-extra' ), |
| 956 | ) |
| 957 | ); |
| 958 | |
| 959 | $manager->register_setting( |
| 960 | 'ocean_menu_link_color_hover', // Same as control name. |
| 961 | array( |
| 962 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 963 | ) |
| 964 | ); |
| 965 | |
| 966 | $manager->register_control( |
| 967 | 'ocean_menu_link_color_active', // Same as setting name. |
| 968 | array( |
| 969 | 'section' => 'oceanwp_mb_menu', |
| 970 | 'type' => 'rgba-color', |
| 971 | 'label' => esc_html__( 'Link Color: Current Menu Item', 'ocean-extra' ), |
| 972 | 'description' => esc_html__( 'Select a color. Hex code, ex: #555', 'ocean-extra' ), |
| 973 | ) |
| 974 | ); |
| 975 | |
| 976 | $manager->register_setting( |
| 977 | 'ocean_menu_link_color_active', // Same as control name. |
| 978 | array( |
| 979 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 980 | ) |
| 981 | ); |
| 982 | |
| 983 | $manager->register_control( |
| 984 | 'ocean_menu_link_background', // Same as setting name. |
| 985 | array( |
| 986 | 'section' => 'oceanwp_mb_menu', |
| 987 | 'type' => 'rgba-color', |
| 988 | 'label' => esc_html__( 'Link Background', 'ocean-extra' ), |
| 989 | 'description' => esc_html__( 'Select a color. Hex code, ex: #fff', 'ocean-extra' ), |
| 990 | ) |
| 991 | ); |
| 992 | |
| 993 | $manager->register_setting( |
| 994 | 'ocean_menu_link_background', // Same as control name. |
| 995 | array( |
| 996 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 997 | ) |
| 998 | ); |
| 999 | |
| 1000 | $manager->register_control( |
| 1001 | 'ocean_menu_link_hover_background', // Same as setting name. |
| 1002 | array( |
| 1003 | 'section' => 'oceanwp_mb_menu', |
| 1004 | 'type' => 'rgba-color', |
| 1005 | 'label' => esc_html__( 'Link Background: Hover', 'ocean-extra' ), |
| 1006 | 'description' => esc_html__( 'Select a color. Hex code, ex: #333', 'ocean-extra' ), |
| 1007 | ) |
| 1008 | ); |
| 1009 | |
| 1010 | $manager->register_setting( |
| 1011 | 'ocean_menu_link_hover_background', // Same as control name. |
| 1012 | array( |
| 1013 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1014 | ) |
| 1015 | ); |
| 1016 | |
| 1017 | $manager->register_control( |
| 1018 | 'ocean_menu_link_active_background', // Same as setting name. |
| 1019 | array( |
| 1020 | 'section' => 'oceanwp_mb_menu', |
| 1021 | 'type' => 'rgba-color', |
| 1022 | 'label' => esc_html__( 'Link Background: Current Menu Item', 'ocean-extra' ), |
| 1023 | 'description' => esc_html__( 'Select a color. Hex code, ex: #13aff0', 'ocean-extra' ), |
| 1024 | ) |
| 1025 | ); |
| 1026 | |
| 1027 | $manager->register_setting( |
| 1028 | 'ocean_menu_link_active_background', // Same as control name. |
| 1029 | array( |
| 1030 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1031 | ) |
| 1032 | ); |
| 1033 | |
| 1034 | $manager->register_control( |
| 1035 | 'ocean_menu_social_links_bg', // Same as setting name. |
| 1036 | array( |
| 1037 | 'section' => 'oceanwp_mb_menu', |
| 1038 | 'type' => 'rgba-color', |
| 1039 | 'label' => esc_html__( 'Simple Social: Background Color', 'ocean-extra' ), |
| 1040 | 'description' => esc_html__( 'Select a background color for the simple social style. Hex code, ex: #fff', 'ocean-extra' ), |
| 1041 | ) |
| 1042 | ); |
| 1043 | |
| 1044 | $manager->register_setting( |
| 1045 | 'ocean_menu_social_links_bg', // Same as control name. |
| 1046 | array( |
| 1047 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1048 | ) |
| 1049 | ); |
| 1050 | |
| 1051 | $manager->register_control( |
| 1052 | 'ocean_menu_social_hover_links_bg', // Same as setting name. |
| 1053 | array( |
| 1054 | 'section' => 'oceanwp_mb_menu', |
| 1055 | 'type' => 'rgba-color', |
| 1056 | 'label' => esc_html__( 'Simple Social: Hover Background Color', 'ocean-extra' ), |
| 1057 | 'description' => esc_html__( 'Select a background color for the simple social style. Hex code, ex: #333', 'ocean-extra' ), |
| 1058 | ) |
| 1059 | ); |
| 1060 | |
| 1061 | $manager->register_setting( |
| 1062 | 'ocean_menu_social_hover_links_bg', // Same as control name. |
| 1063 | array( |
| 1064 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1065 | ) |
| 1066 | ); |
| 1067 | |
| 1068 | $manager->register_control( |
| 1069 | 'ocean_menu_social_links_color', // Same as setting name. |
| 1070 | array( |
| 1071 | 'section' => 'oceanwp_mb_menu', |
| 1072 | 'type' => 'rgba-color', |
| 1073 | 'label' => esc_html__( 'Simple Social: Color', 'ocean-extra' ), |
| 1074 | 'description' => esc_html__( 'Select a color for the simple social style. Hex code, ex: #fff', 'ocean-extra' ), |
| 1075 | ) |
| 1076 | ); |
| 1077 | |
| 1078 | $manager->register_setting( |
| 1079 | 'ocean_menu_social_links_color', // Same as control name. |
| 1080 | array( |
| 1081 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1082 | ) |
| 1083 | ); |
| 1084 | |
| 1085 | $manager->register_control( |
| 1086 | 'ocean_menu_social_hover_links_color', // Same as setting name. |
| 1087 | array( |
| 1088 | 'section' => 'oceanwp_mb_menu', |
| 1089 | 'type' => 'rgba-color', |
| 1090 | 'label' => esc_html__( 'Simple Social: Hover Color', 'ocean-extra' ), |
| 1091 | 'description' => esc_html__( 'Select a color for the simple social style. Hex code, ex: #13aff0', 'ocean-extra' ), |
| 1092 | ) |
| 1093 | ); |
| 1094 | |
| 1095 | $manager->register_setting( |
| 1096 | 'ocean_menu_social_hover_links_color', // Same as control name. |
| 1097 | array( |
| 1098 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1099 | ) |
| 1100 | ); |
| 1101 | |
| 1102 | $manager->register_section( |
| 1103 | 'oceanwp_mb_title', |
| 1104 | array( |
| 1105 | 'label' => esc_html__( 'Title', 'ocean-extra' ), |
| 1106 | 'icon' => 'dashicons-admin-tools' |
| 1107 | ) |
| 1108 | ); |
| 1109 | |
| 1110 | $manager->register_control( |
| 1111 | 'ocean_disable_title', // Same as setting name. |
| 1112 | array( |
| 1113 | 'section' => 'oceanwp_mb_title', |
| 1114 | 'type' => 'buttonset', |
| 1115 | 'label' => esc_html__( 'Display Page Title', 'ocean-extra' ), |
| 1116 | 'description' => esc_html__( 'Enable or disable the page title.', 'ocean-extra' ), |
| 1117 | 'choices' => array( |
| 1118 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 1119 | 'enable' => esc_html__( 'Enable', 'ocean-extra' ), |
| 1120 | 'on' => esc_html__( 'Disable', 'ocean-extra' ), |
| 1121 | ), |
| 1122 | ) |
| 1123 | ); |
| 1124 | |
| 1125 | $manager->register_setting( |
| 1126 | 'ocean_disable_title', // Same as control name. |
| 1127 | array( |
| 1128 | 'sanitize_callback' => 'sanitize_key', |
| 1129 | 'default' => 'default', |
| 1130 | ) |
| 1131 | ); |
| 1132 | |
| 1133 | $manager->register_control( |
| 1134 | 'ocean_disable_heading', // Same as setting name. |
| 1135 | array( |
| 1136 | 'section' => 'oceanwp_mb_title', |
| 1137 | 'type' => 'buttonset', |
| 1138 | 'label' => esc_html__( 'Display Heading', 'ocean-extra' ), |
| 1139 | 'description' => esc_html__( 'Enable or disable the page title heading.', 'ocean-extra' ), |
| 1140 | 'choices' => array( |
| 1141 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 1142 | 'enable' => esc_html__( 'Enable', 'ocean-extra' ), |
| 1143 | 'on' => esc_html__( 'Disable', 'ocean-extra' ), |
| 1144 | ), |
| 1145 | ) |
| 1146 | ); |
| 1147 | |
| 1148 | $manager->register_setting( |
| 1149 | 'ocean_disable_heading', // Same as control name. |
| 1150 | array( |
| 1151 | 'sanitize_callback' => 'sanitize_key', |
| 1152 | 'default' => 'default', |
| 1153 | ) |
| 1154 | ); |
| 1155 | |
| 1156 | $manager->register_control( |
| 1157 | 'ocean_post_title', // Same as setting name. |
| 1158 | array( |
| 1159 | 'section' => 'oceanwp_mb_title', |
| 1160 | 'type' => 'text', |
| 1161 | 'label' => esc_html__( 'Custom Title', 'ocean-extra' ), |
| 1162 | 'description' => esc_html__( 'Alter the main title display.', 'ocean-extra' ), |
| 1163 | ) |
| 1164 | ); |
| 1165 | |
| 1166 | $manager->register_setting( |
| 1167 | 'ocean_post_title', // Same as control name. |
| 1168 | array( |
| 1169 | 'sanitize_callback' => 'wp_kses_post', |
| 1170 | ) |
| 1171 | ); |
| 1172 | |
| 1173 | $manager->register_control( |
| 1174 | 'ocean_post_subheading', // Same as setting name. |
| 1175 | array( |
| 1176 | 'section' => 'oceanwp_mb_title', |
| 1177 | 'type' => 'text', |
| 1178 | 'label' => esc_html__( 'Subheading', 'ocean-extra' ), |
| 1179 | 'description' => esc_html__( 'Enter your page subheading. Shortcodes & HTML is allowed.', 'ocean-extra' ), |
| 1180 | ) |
| 1181 | ); |
| 1182 | |
| 1183 | $manager->register_setting( |
| 1184 | 'ocean_post_subheading', // Same as control name. |
| 1185 | array( |
| 1186 | 'sanitize_callback' => 'wp_kses_post', |
| 1187 | ) |
| 1188 | ); |
| 1189 | |
| 1190 | $manager->register_control( |
| 1191 | 'ocean_post_title_style', // Same as setting name. |
| 1192 | array( |
| 1193 | 'section' => 'oceanwp_mb_title', |
| 1194 | 'type' => 'select', |
| 1195 | 'label' => esc_html__( 'Title Style', 'ocean-extra' ), |
| 1196 | 'description' => esc_html__( 'Select a custom title style.', 'ocean-extra' ), |
| 1197 | 'choices' => $this->helpers( 'title_styles' ), |
| 1198 | ) |
| 1199 | ); |
| 1200 | |
| 1201 | $manager->register_setting( |
| 1202 | 'ocean_post_title_style', // Same as control name. |
| 1203 | array( |
| 1204 | 'sanitize_callback' => 'sanitize_key', |
| 1205 | ) |
| 1206 | ); |
| 1207 | |
| 1208 | $manager->register_control( |
| 1209 | 'ocean_post_title_background_color', // Same as setting name. |
| 1210 | array( |
| 1211 | 'section' => 'oceanwp_mb_title', |
| 1212 | 'type' => 'color', |
| 1213 | 'label' => esc_html__( 'Title: Background Color', 'ocean-extra' ), |
| 1214 | 'description' => esc_html__( 'Select a hex color code, ex: #333', 'ocean-extra' ), |
| 1215 | ) |
| 1216 | ); |
| 1217 | |
| 1218 | $manager->register_setting( |
| 1219 | 'ocean_post_title_background_color', // Same as control name. |
| 1220 | array( |
| 1221 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1222 | ) |
| 1223 | ); |
| 1224 | |
| 1225 | $manager->register_control( |
| 1226 | 'ocean_post_title_background', // Same as setting name. |
| 1227 | array( |
| 1228 | 'section' => 'oceanwp_mb_title', |
| 1229 | 'type' => 'image', |
| 1230 | 'label' => esc_html__( 'Title: Background Image', 'ocean-extra' ), |
| 1231 | 'description' => esc_html__( 'Select a custom image for your main title.', 'ocean-extra' ), |
| 1232 | ) |
| 1233 | ); |
| 1234 | |
| 1235 | $manager->register_setting( |
| 1236 | 'ocean_post_title_background', // Same as control name. |
| 1237 | array( |
| 1238 | 'sanitize_callback' => 'sanitize_key', |
| 1239 | ) |
| 1240 | ); |
| 1241 | |
| 1242 | $manager->register_control( |
| 1243 | 'ocean_post_title_bg_image_position', // Same as setting name. |
| 1244 | array( |
| 1245 | 'section' => 'oceanwp_mb_title', |
| 1246 | 'type' => 'select', |
| 1247 | 'label' => esc_html__( 'Position', 'ocean-extra' ), |
| 1248 | 'description' => esc_html__( 'Select your background image position.', 'ocean-extra' ), |
| 1249 | 'choices' => array( |
| 1250 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 1251 | 'top left' => esc_html__( 'Top Left', 'ocean-extra' ), |
| 1252 | 'top center' => esc_html__( 'Top Center', 'ocean-extra' ), |
| 1253 | 'top right' => esc_html__( 'Top Right', 'ocean-extra' ), |
| 1254 | 'center left' => esc_html__( 'Center Left', 'ocean-extra' ), |
| 1255 | 'center center' => esc_html__( 'Center Center', 'ocean-extra' ), |
| 1256 | 'center right' => esc_html__( 'Center Right', 'ocean-extra' ), |
| 1257 | 'bottom left' => esc_html__( 'Bottom Left', 'ocean-extra' ), |
| 1258 | 'bottom center' => esc_html__( 'Bottom Center', 'ocean-extra' ), |
| 1259 | 'bottom right' => esc_html__( 'Bottom Right', 'ocean-extra' ), |
| 1260 | ), |
| 1261 | ) |
| 1262 | ); |
| 1263 | |
| 1264 | $manager->register_setting( |
| 1265 | 'ocean_post_title_bg_image_position', // Same as control name. |
| 1266 | array( |
| 1267 | 'sanitize_callback' => 'sanitize_text_field', |
| 1268 | ) |
| 1269 | ); |
| 1270 | |
| 1271 | $manager->register_control( |
| 1272 | 'ocean_post_title_bg_image_attachment', // Same as setting name. |
| 1273 | array( |
| 1274 | 'section' => 'oceanwp_mb_title', |
| 1275 | 'type' => 'select', |
| 1276 | 'label' => esc_html__( 'Attachment', 'ocean-extra' ), |
| 1277 | 'description' => esc_html__( 'Select your background image attachment.', 'ocean-extra' ), |
| 1278 | 'choices' => array( |
| 1279 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 1280 | 'scroll' => esc_html__( 'Scroll', 'ocean-extra' ), |
| 1281 | 'fixed' => esc_html__( 'Fixed', 'ocean-extra' ), |
| 1282 | ), |
| 1283 | ) |
| 1284 | ); |
| 1285 | |
| 1286 | $manager->register_setting( |
| 1287 | 'ocean_post_title_bg_image_attachment', // Same as control name. |
| 1288 | array( |
| 1289 | 'sanitize_callback' => 'sanitize_key', |
| 1290 | ) |
| 1291 | ); |
| 1292 | |
| 1293 | $manager->register_control( |
| 1294 | 'ocean_post_title_bg_image_repeat', // Same as setting name. |
| 1295 | array( |
| 1296 | 'section' => 'oceanwp_mb_title', |
| 1297 | 'type' => 'select', |
| 1298 | 'label' => esc_html__( 'Repeat', 'ocean-extra' ), |
| 1299 | 'description' => esc_html__( 'Select your background image repeat.', 'ocean-extra' ), |
| 1300 | 'choices' => array( |
| 1301 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 1302 | 'no-repeat' => esc_html__( 'No-repeat', 'ocean-extra' ), |
| 1303 | 'repeat' => esc_html__( 'Repeat', 'ocean-extra' ), |
| 1304 | 'repeat-x' => esc_html__( 'Repeat-x', 'ocean-extra' ), |
| 1305 | 'repeat-y' => esc_html__( 'Repeat-y', 'ocean-extra' ), |
| 1306 | ), |
| 1307 | ) |
| 1308 | ); |
| 1309 | |
| 1310 | $manager->register_setting( |
| 1311 | 'ocean_post_title_bg_image_repeat', // Same as control name. |
| 1312 | array( |
| 1313 | 'sanitize_callback' => 'sanitize_key', |
| 1314 | ) |
| 1315 | ); |
| 1316 | |
| 1317 | $manager->register_control( |
| 1318 | 'ocean_post_title_bg_image_size', // Same as setting name. |
| 1319 | array( |
| 1320 | 'section' => 'oceanwp_mb_title', |
| 1321 | 'type' => 'select', |
| 1322 | 'label' => esc_html__( 'Size', 'ocean-extra' ), |
| 1323 | 'description' => esc_html__( 'Select your background image size.', 'ocean-extra' ), |
| 1324 | 'choices' => array( |
| 1325 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 1326 | 'auto' => esc_html__( 'Auto', 'ocean-extra' ), |
| 1327 | 'cover' => esc_html__( 'Cover', 'ocean-extra' ), |
| 1328 | 'contain' => esc_html__( 'Contain', 'ocean-extra' ), |
| 1329 | ), |
| 1330 | ) |
| 1331 | ); |
| 1332 | |
| 1333 | $manager->register_setting( |
| 1334 | 'ocean_post_title_bg_image_size', // Same as control name. |
| 1335 | array( |
| 1336 | 'sanitize_callback' => 'sanitize_key', |
| 1337 | ) |
| 1338 | ); |
| 1339 | |
| 1340 | $manager->register_control( |
| 1341 | 'ocean_post_title_height', // Same as setting name. |
| 1342 | array( |
| 1343 | 'section' => 'oceanwp_mb_title', |
| 1344 | 'type' => 'number', |
| 1345 | 'label' => esc_html__( 'Title: Background Height', 'ocean-extra' ), |
| 1346 | 'description' => esc_html__( 'Select your custom height for your title background. Default is 400px.', 'ocean-extra' ), |
| 1347 | 'attr' => array( |
| 1348 | 'min' => '0', |
| 1349 | 'step' => '1', |
| 1350 | ), |
| 1351 | ) |
| 1352 | ); |
| 1353 | |
| 1354 | $manager->register_setting( |
| 1355 | 'ocean_post_title_height', // Same as control name. |
| 1356 | array( |
| 1357 | 'sanitize_callback' => array( $this, 'sanitize_absint' ), |
| 1358 | ) |
| 1359 | ); |
| 1360 | |
| 1361 | $manager->register_control( |
| 1362 | 'ocean_post_title_bg_overlay', // Same as setting name. |
| 1363 | array( |
| 1364 | 'section' => 'oceanwp_mb_title', |
| 1365 | 'type' => 'number', |
| 1366 | 'label' => esc_html__( 'Title: Background Overlay Opacity', 'ocean-extra' ), |
| 1367 | 'description' => esc_html__( 'Enter a number between 0.1 to 1. Default is 0.5.', 'ocean-extra' ), |
| 1368 | 'attr' => array( |
| 1369 | 'min' => '0.1', |
| 1370 | 'max' => '1', |
| 1371 | 'step' => '0.1', |
| 1372 | ), |
| 1373 | ) |
| 1374 | ); |
| 1375 | |
| 1376 | $manager->register_setting( |
| 1377 | 'ocean_post_title_bg_overlay', // Same as control name. |
| 1378 | array( |
| 1379 | 'sanitize_callback' => 'sanitize_text_field', |
| 1380 | ) |
| 1381 | ); |
| 1382 | |
| 1383 | $manager->register_control( |
| 1384 | 'ocean_post_title_bg_overlay_color', // Same as setting name. |
| 1385 | array( |
| 1386 | 'section' => 'oceanwp_mb_title', |
| 1387 | 'type' => 'color', |
| 1388 | 'label' => esc_html__( 'Title: Background Overlay Color', 'ocean-extra' ), |
| 1389 | 'description' => esc_html__( 'Select a color. Hex code, ex: #333', 'ocean-extra' ), |
| 1390 | ) |
| 1391 | ); |
| 1392 | |
| 1393 | $manager->register_setting( |
| 1394 | 'ocean_post_title_bg_overlay_color', // Same as control name. |
| 1395 | array( |
| 1396 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1397 | ) |
| 1398 | ); |
| 1399 | |
| 1400 | $manager->register_section( |
| 1401 | 'oceanwp_mb_breadcrumbs', |
| 1402 | array( |
| 1403 | 'label' => esc_html__( 'Breadcrumbs', 'ocean-extra' ), |
| 1404 | 'icon' => 'dashicons-admin-home' |
| 1405 | ) |
| 1406 | ); |
| 1407 | |
| 1408 | $manager->register_control( |
| 1409 | 'ocean_disable_breadcrumbs', // Same as setting name. |
| 1410 | array( |
| 1411 | 'section' => 'oceanwp_mb_breadcrumbs', |
| 1412 | 'type' => 'buttonset', |
| 1413 | 'label' => esc_html__( 'Display Breadcrumbs', 'ocean-extra' ), |
| 1414 | 'description' => esc_html__( 'Enable or disable the page title breadcrumbs.', 'ocean-extra' ), |
| 1415 | 'choices' => array( |
| 1416 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 1417 | 'on' => esc_html__( 'Enable', 'ocean-extra' ), |
| 1418 | 'off' => esc_html__( 'Disable', 'ocean-extra' ), |
| 1419 | ), |
| 1420 | ) |
| 1421 | ); |
| 1422 | |
| 1423 | $manager->register_setting( |
| 1424 | 'ocean_disable_breadcrumbs', // Same as control name. |
| 1425 | array( |
| 1426 | 'sanitize_callback' => 'sanitize_key', |
| 1427 | 'default' => 'default', |
| 1428 | ) |
| 1429 | ); |
| 1430 | |
| 1431 | $manager->register_control( |
| 1432 | 'ocean_breadcrumbs_color', // Same as setting name. |
| 1433 | array( |
| 1434 | 'section' => 'oceanwp_mb_breadcrumbs', |
| 1435 | 'type' => 'color', |
| 1436 | 'label' => esc_html__( 'Color', 'ocean-extra' ), |
| 1437 | 'description' => esc_html__( 'Select a color. Hex code, ex: #fff', 'ocean-extra' ), |
| 1438 | ) |
| 1439 | ); |
| 1440 | |
| 1441 | $manager->register_setting( |
| 1442 | 'ocean_breadcrumbs_color', // Same as control name. |
| 1443 | array( |
| 1444 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1445 | ) |
| 1446 | ); |
| 1447 | |
| 1448 | $manager->register_control( |
| 1449 | 'ocean_breadcrumbs_separator_color', // Same as setting name. |
| 1450 | array( |
| 1451 | 'section' => 'oceanwp_mb_breadcrumbs', |
| 1452 | 'type' => 'color', |
| 1453 | 'label' => esc_html__( 'Separator Color', 'ocean-extra' ), |
| 1454 | 'description' => esc_html__( 'Select a color. Hex code, ex: #fff', 'ocean-extra' ), |
| 1455 | ) |
| 1456 | ); |
| 1457 | |
| 1458 | $manager->register_setting( |
| 1459 | 'ocean_breadcrumbs_separator_color', // Same as control name. |
| 1460 | array( |
| 1461 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1462 | ) |
| 1463 | ); |
| 1464 | |
| 1465 | $manager->register_control( |
| 1466 | 'ocean_breadcrumbs_links_color', // Same as setting name. |
| 1467 | array( |
| 1468 | 'section' => 'oceanwp_mb_breadcrumbs', |
| 1469 | 'type' => 'color', |
| 1470 | 'label' => esc_html__( 'Links Color', 'ocean-extra' ), |
| 1471 | 'description' => esc_html__( 'Select a color. Hex code, ex: #fff', 'ocean-extra' ), |
| 1472 | ) |
| 1473 | ); |
| 1474 | |
| 1475 | $manager->register_setting( |
| 1476 | 'ocean_breadcrumbs_links_color', // Same as control name. |
| 1477 | array( |
| 1478 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1479 | ) |
| 1480 | ); |
| 1481 | |
| 1482 | $manager->register_control( |
| 1483 | 'ocean_breadcrumbs_links_hover_color', // Same as setting name. |
| 1484 | array( |
| 1485 | 'section' => 'oceanwp_mb_breadcrumbs', |
| 1486 | 'type' => 'color', |
| 1487 | 'label' => esc_html__( 'Links Color: Hover', 'ocean-extra' ), |
| 1488 | 'description' => esc_html__( 'Select a color. Hex code, ex: #ddd', 'ocean-extra' ), |
| 1489 | ) |
| 1490 | ); |
| 1491 | |
| 1492 | $manager->register_setting( |
| 1493 | 'ocean_breadcrumbs_links_hover_color', // Same as control name. |
| 1494 | array( |
| 1495 | 'sanitize_callback' => 'butterbean_maybe_hash_hex_color', |
| 1496 | ) |
| 1497 | ); |
| 1498 | |
| 1499 | $manager->register_section( |
| 1500 | 'oceanwp_mb_footer', |
| 1501 | array( |
| 1502 | 'label' => esc_html__( 'Footer', 'ocean-extra' ), |
| 1503 | 'icon' => 'dashicons-hammer' |
| 1504 | ) |
| 1505 | ); |
| 1506 | |
| 1507 | $manager->register_control( |
| 1508 | 'ocean_display_footer_widgets', // Same as setting name. |
| 1509 | array( |
| 1510 | 'section' => 'oceanwp_mb_footer', |
| 1511 | 'type' => 'buttonset', |
| 1512 | 'label' => esc_html__( 'Display Footer Widgets Area', 'ocean-extra' ), |
| 1513 | 'description' => esc_html__( 'Enable or disable the footer widgets area.', 'ocean-extra' ), |
| 1514 | 'choices' => array( |
| 1515 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 1516 | 'on' => esc_html__( 'Enable', 'ocean-extra' ), |
| 1517 | 'off' => esc_html__( 'Disable', 'ocean-extra' ), |
| 1518 | ), |
| 1519 | ) |
| 1520 | ); |
| 1521 | |
| 1522 | $manager->register_setting( |
| 1523 | 'ocean_display_footer_widgets', // Same as control name. |
| 1524 | array( |
| 1525 | 'sanitize_callback' => 'sanitize_key', |
| 1526 | 'default' => 'default', |
| 1527 | ) |
| 1528 | ); |
| 1529 | |
| 1530 | $manager->register_control( |
| 1531 | 'ocean_display_footer_bottom', // Same as setting name. |
| 1532 | array( |
| 1533 | 'section' => 'oceanwp_mb_footer', |
| 1534 | 'type' => 'buttonset', |
| 1535 | 'label' => esc_html__( 'Display Copyright Area', 'ocean-extra' ), |
| 1536 | 'description' => esc_html__( 'Enable or disable the copyright area.', 'ocean-extra' ), |
| 1537 | 'choices' => array( |
| 1538 | 'default' => esc_html__( 'Default', 'ocean-extra' ), |
| 1539 | 'on' => esc_html__( 'Enable', 'ocean-extra' ), |
| 1540 | 'off' => esc_html__( 'Disable', 'ocean-extra' ), |
| 1541 | ), |
| 1542 | ) |
| 1543 | ); |
| 1544 | |
| 1545 | $manager->register_setting( |
| 1546 | 'ocean_display_footer_bottom', // Same as control name. |
| 1547 | array( |
| 1548 | 'sanitize_callback' => 'sanitize_key', |
| 1549 | 'default' => 'default', |
| 1550 | ) |
| 1551 | ); |
| 1552 | |
| 1553 | $manager->register_control( |
| 1554 | 'ocean_custom_footer_template', // Same as setting name. |
| 1555 | array( |
| 1556 | 'section' => 'oceanwp_mb_footer', |
| 1557 | 'type' => 'select', |
| 1558 | 'label' => esc_html__( 'Select Template', 'ocean-extra' ), |
| 1559 | 'description' => esc_html__( 'Choose a template created in Theme Panel > My Library.', 'ocean-extra' ), |
| 1560 | 'choices' => $this->helpers( 'library' ), |
| 1561 | ) |
| 1562 | ); |
| 1563 | |
| 1564 | $manager->register_setting( |
| 1565 | 'ocean_custom_footer_template', // Same as control name. |
| 1566 | array( |
| 1567 | 'sanitize_callback' => 'sanitize_key', |
| 1568 | ) |
| 1569 | ); |
| 1570 | |
| 1571 | } |
| 1572 | |
| 1573 | /** |
| 1574 | * Registration callback |
| 1575 | * |
| 1576 | * @since 1.1.2 |
| 1577 | */ |
| 1578 | public function posts_register( $butterbean, $post_type ) { |
| 1579 | |
| 1580 | // Return if it is not Post post type |
| 1581 | if ( 'post' != $post_type ) { |
| 1582 | return; |
| 1583 | } |
| 1584 | |
| 1585 | // Gets the manager object we want to add sections to. |
| 1586 | $manager = $butterbean->get_manager( 'oceanwp_mb_settings' ); |
| 1587 | |
| 1588 | $manager->register_section( |
| 1589 | 'oceanwp_mb_post', |
| 1590 | array( |
| 1591 | 'label' => esc_html__( 'Post', 'ocean-extra' ), |
| 1592 | 'icon' => 'dashicons-admin-page', |
| 1593 | ) |
| 1594 | ); |
| 1595 | |
| 1596 | $manager->register_control( |
| 1597 | 'ocean_post_oembed', // Same as setting name. |
| 1598 | array( |
| 1599 | 'section' => 'oceanwp_mb_post', |
| 1600 | 'type' => 'text', |
| 1601 | 'label' => esc_html__( 'oEmbed URL', 'ocean-extra' ), |
| 1602 | 'description' => esc_html__( 'Enter a URL that is compatible with WP\'s built-in oEmbed feature. This setting is used for your video and audio post formats.', 'ocean-extra' ) .'<br /><a href="http://codex.wordpress.org/Embeds" target="_blank">'. esc_html__( 'Learn More', 'ocean-extra' ) .' →</a>', |
| 1603 | ) |
| 1604 | ); |
| 1605 | |
| 1606 | $manager->register_setting( |
| 1607 | 'ocean_post_oembed', // Same as control name. |
| 1608 | array( |
| 1609 | 'sanitize_callback' => 'sanitize_text_field', |
| 1610 | ) |
| 1611 | ); |
| 1612 | |
| 1613 | $manager->register_control( |
| 1614 | 'ocean_post_self_hosted_media', // Same as setting name. |
| 1615 | array( |
| 1616 | 'section' => 'oceanwp_mb_post', |
| 1617 | 'type' => 'media', |
| 1618 | 'label' => esc_html__( 'Self Hosted', 'ocean-extra' ), |
| 1619 | 'description' => esc_html__( 'Insert your self hosted video or audio url here.', 'ocean-extra' ) .'<br /><a href="http://make.wordpress.org/core/2013/04/08/audio-video-support-in-core/" target="_blank">'. esc_html__( 'Learn More', 'ocean-extra' ) .' →</a>', |
| 1620 | ) |
| 1621 | ); |
| 1622 | |
| 1623 | $manager->register_setting( |
| 1624 | 'ocean_post_self_hosted_media', // Same as control name. |
| 1625 | array( |
| 1626 | 'sanitize_callback' => 'sanitize_text_field', |
| 1627 | ) |
| 1628 | ); |
| 1629 | |
| 1630 | $manager->register_control( |
| 1631 | 'ocean_post_video_embed', // Same as setting name. |
| 1632 | array( |
| 1633 | 'section' => 'oceanwp_mb_post', |
| 1634 | 'type' => 'textarea', |
| 1635 | 'label' => esc_html__( 'Embed Code', 'ocean-extra' ), |
| 1636 | 'description' => esc_html__( 'Insert your embed/iframe code. This setting is used for your video and audio post formats.', 'ocean-extra' ), |
| 1637 | 'attr' => array( 'row' => '2', 'cols' => '1' ), |
| 1638 | ) |
| 1639 | ); |
| 1640 | |
| 1641 | $manager->register_setting( |
| 1642 | 'ocean_post_video_embed' // Same as control name. |
| 1643 | ); |
| 1644 | |
| 1645 | $manager->register_control( |
| 1646 | 'ocean_link_format', // Same as setting name. |
| 1647 | array( |
| 1648 | 'section' => 'oceanwp_mb_post', |
| 1649 | 'type' => 'text', |
| 1650 | 'label' => esc_html__( 'Link', 'ocean-extra' ), |
| 1651 | 'description' => esc_html__( 'Enter your external url. This setting is used for your link post formats.', 'ocean-extra' ), |
| 1652 | ) |
| 1653 | ); |
| 1654 | |
| 1655 | $manager->register_setting( |
| 1656 | 'ocean_link_format', // Same as control name. |
| 1657 | array( |
| 1658 | 'sanitize_callback' => 'sanitize_text_field', |
| 1659 | ) |
| 1660 | ); |
| 1661 | |
| 1662 | $manager->register_control( |
| 1663 | 'ocean_link_format_target', // Same as setting name. |
| 1664 | array( |
| 1665 | 'section' => 'oceanwp_mb_post', |
| 1666 | 'type' => 'buttonset', |
| 1667 | 'label' => esc_html__( 'Link Target', 'ocean-extra' ), |
| 1668 | 'description' => esc_html__( 'Choose your target for the url. This setting is used for your link post formats.', 'ocean-extra' ), |
| 1669 | 'choices' => array( |
| 1670 | 'self' => esc_html__( 'Self', 'ocean-extra' ), |
| 1671 | 'blank' => esc_html__( 'Blank', 'ocean-extra' ), |
| 1672 | ), |
| 1673 | ) |
| 1674 | ); |
| 1675 | |
| 1676 | $manager->register_setting( |
| 1677 | 'ocean_link_format_target', // Same as control name. |
| 1678 | array( |
| 1679 | 'sanitize_callback' => 'sanitize_text_field', |
| 1680 | 'default' => 'self', |
| 1681 | ) |
| 1682 | ); |
| 1683 | |
| 1684 | $manager->register_control( |
| 1685 | 'ocean_quote_format', // Same as setting name. |
| 1686 | array( |
| 1687 | 'section' => 'oceanwp_mb_post', |
| 1688 | 'type' => 'textarea', |
| 1689 | 'label' => esc_html__( 'Quote', 'ocean-extra' ), |
| 1690 | 'description' => esc_html__( 'Enter your quote. This setting is used for your quote post formats.', 'ocean-extra' ), |
| 1691 | 'attr' => array( 'row' => '2', 'cols' => '1' ), |
| 1692 | ) |
| 1693 | ); |
| 1694 | |
| 1695 | $manager->register_setting( |
| 1696 | 'ocean_quote_format', // Same as control name. |
| 1697 | array( |
| 1698 | 'sanitize_callback' => 'wp_kses_post', |
| 1699 | ) |
| 1700 | ); |
| 1701 | |
| 1702 | $manager->register_control( |
| 1703 | 'ocean_quote_format_link', // Same as setting name. |
| 1704 | array( |
| 1705 | 'section' => 'oceanwp_mb_post', |
| 1706 | 'type' => 'buttonset', |
| 1707 | 'label' => esc_html__( 'Quote Link', 'ocean-extra' ), |
| 1708 | 'description' => esc_html__( 'Choose your quote link. This setting is used for your quote post formats.', 'ocean-extra' ), |
| 1709 | 'choices' => array( |
| 1710 | 'post' => esc_html__( 'Post', 'ocean-extra' ), |
| 1711 | 'none' => esc_html__( 'None', 'ocean-extra' ), |
| 1712 | ), |
| 1713 | ) |
| 1714 | ); |
| 1715 | |
| 1716 | $manager->register_setting( |
| 1717 | 'ocean_quote_format_link', // Same as control name. |
| 1718 | array( |
| 1719 | 'sanitize_callback' => 'sanitize_text_field', |
| 1720 | 'default' => 'post', |
| 1721 | ) |
| 1722 | ); |
| 1723 | |
| 1724 | } |
| 1725 | |
| 1726 | /** |
| 1727 | * Sanitize function for integers |
| 1728 | * |
| 1729 | * @since 1.0.0 |
| 1730 | */ |
| 1731 | public function sanitize_absint( $value ) { |
| 1732 | return $value && is_numeric( $value ) ? absint( $value ) : ''; |
| 1733 | } |
| 1734 | |
| 1735 | /** |
| 1736 | * Helpers |
| 1737 | * |
| 1738 | * @since 1.0.0 |
| 1739 | */ |
| 1740 | public static function helpers( $return = NULL ) { |
| 1741 | |
| 1742 | // Return array of WP menus |
| 1743 | if ( 'menus' == $return ) { |
| 1744 | $menus = array( esc_html__( 'Default', 'ocean-extra' ) ); |
| 1745 | $get_menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); |
| 1746 | foreach ( $get_menus as $menu) { |
| 1747 | $menus[$menu->term_id] = $menu->name; |
| 1748 | } |
| 1749 | return $menus; |
| 1750 | } |
| 1751 | |
| 1752 | // Header template |
| 1753 | elseif ( 'library' == $return ) { |
| 1754 | $templates = array( esc_html__( 'Select a Template', 'ocean-extra' ) ); |
| 1755 | $get_templates = get_posts( array( 'post_type' => 'oceanwp_library', 'numberposts' => -1, 'post_status' => 'publish' ) ); |
| 1756 | |
| 1757 | if ( ! empty ( $get_templates ) ) { |
| 1758 | foreach ( $get_templates as $template ) { |
| 1759 | $templates[ $template->ID ] = $template->post_title; |
| 1760 | } |
| 1761 | } |
| 1762 | |
| 1763 | return $templates; |
| 1764 | } |
| 1765 | |
| 1766 | // Title styles |
| 1767 | elseif ( 'title_styles' == $return ) { |
| 1768 | return apply_filters( 'ocean_title_styles', array( |
| 1769 | '' => esc_html__( 'Default', 'ocean-extra' ), |
| 1770 | 'default' => esc_html__( 'Default Style', 'ocean-extra' ), |
| 1771 | 'centered' => esc_html__( 'Centered', 'ocean-extra' ), |
| 1772 | 'centered' => esc_html__( 'Centered', 'ocean-extra' ), |
| 1773 | 'centered-minimal' => esc_html__( 'Centered Minimal', 'ocean-extra' ), |
| 1774 | 'background-image' => esc_html__( 'Background Image', 'ocean-extra' ), |
| 1775 | 'solid-color' => esc_html__( 'Solid Color and White Text', 'ocean-extra' ), |
| 1776 | ) ); |
| 1777 | } |
| 1778 | |
| 1779 | // Widgets |
| 1780 | elseif ( 'widget_areas' == $return ) { |
| 1781 | global $wp_registered_sidebars; |
| 1782 | $widgets_areas = array( esc_html__( 'Default', 'ocean-extra' ) ); |
| 1783 | $get_widget_areas = $wp_registered_sidebars; |
| 1784 | if ( ! empty( $get_widget_areas ) ) { |
| 1785 | foreach ( $get_widget_areas as $widget_area ) { |
| 1786 | $name = isset ( $widget_area['name'] ) ? $widget_area['name'] : ''; |
| 1787 | $id = isset ( $widget_area['id'] ) ? $widget_area['id'] : ''; |
| 1788 | if ( $name && $id ) { |
| 1789 | $widgets_areas[$id] = $name; |
| 1790 | } |
| 1791 | } |
| 1792 | } |
| 1793 | return $widgets_areas; |
| 1794 | } |
| 1795 | |
| 1796 | } |
| 1797 | |
| 1798 | /** |
| 1799 | * Returns the instance. |
| 1800 | * |
| 1801 | * @since 1.1.2 |
| 1802 | * @access public |
| 1803 | * @return object |
| 1804 | */ |
| 1805 | public static function get_instance() { |
| 1806 | static $instance = null; |
| 1807 | if ( is_null( $instance ) ) { |
| 1808 | $instance = new self; |
| 1809 | $instance->setup_actions(); |
| 1810 | } |
| 1811 | return $instance; |
| 1812 | } |
| 1813 | |
| 1814 | /** |
| 1815 | * Constructor method. |
| 1816 | * |
| 1817 | * @since 1.1.2 |
| 1818 | * @access private |
| 1819 | * @return void |
| 1820 | */ |
| 1821 | private function __construct() {} |
| 1822 | |
| 1823 | } |
| 1824 | |
| 1825 | OceanWP_Post_Metabox::get_instance(); |
| 1826 | |
| 1827 | } |