manager->get_setting('aleanta_header_type')->value() == 'header3' ) { return true; } else { return false; } } function aleanta_header_type12_callback( $control ) { if ( $control->manager->get_setting('aleanta_header_type')->value() != 'header3' ) { return true; } else { return false; } } function aleanta_header_type4_callback( $control ) { if ( $control->manager->get_setting('aleanta_header_type')->value() == 'header4' ) { return true; } else { return false; } } function aleanta_header_background_callback( $control ) { if ( in_array($control->manager->get_setting('aleanta_header_background')->value(), array('trans-white', 'trans-black')) ) { return true; } else { return false; } } function aleanta_header_menu_callback( $control ) { if ( $control->manager->get_setting('aleanta_header_menu')->value() != 0 ) { return true; } else { return false; } } function aleanta_header_decore_callback ( $control ) { if ( $control->manager->get_setting('aleanta_header_type')->value() == 'header4' ) { return true; } else { return false; } } function aleanta_header_type5_callback( $control ) { if ( $control->manager->get_setting('aleanta_header_type')->value() == 'header5' ) { return true; } else { return false; } } function aleanta_customize_header_tab($wp_customize, $theme_name){ $header_elements = array( 'logo' => esc_html__( 'Logo', 'aleanta' ), 'menu' => esc_html__( 'Menu', 'aleanta' ), 'hamburger' => esc_html__( 'Hamburger Menu', 'aleanta' ), 'logo_menu' => esc_html__( 'Menu With Centered Logo', 'aleanta' ), 'search' => esc_html__( 'Search', 'aleanta' ), 'cart' => esc_html__( 'Cart', 'aleanta' ), 'socials' => esc_html__( 'Socials', 'aleanta' ), 'phone' => esc_html__( 'Phone', 'aleanta' ), 'email' => esc_html__( 'E-mail', 'aleanta' ), 'text' => esc_html__( 'Custom Text', 'aleanta' ), ); $header_elements_position = array( '1' => esc_html__( 'On', 'aleanta' ), '0' => esc_html__( 'Off', 'aleanta' ), 'level_1_left' => esc_html__( 'Level 1 Left', 'aleanta' ), 'level_1_right' => esc_html__( 'Level 1 Right', 'aleanta' ), 'level_1_center' => esc_html__( 'Level 1 Center', 'aleanta' ), 'level_2_left' => esc_html__( 'Level 2 Left', 'aleanta' ), 'level_2_right' => esc_html__( 'Level 2 Right', 'aleanta' ), 'level_2_center' => esc_html__( 'Level 2 Center', 'aleanta' ), 'top_bar_left' => esc_html__( 'Top Bar Left', 'aleanta' ), 'top_bar_right' => esc_html__( 'Top Bar Right', 'aleanta' ), 'top_bar_center' => esc_html__( 'Top Bar Center', 'aleanta' ), ); $wp_customize->add_panel('aleanta_header_panel', array( 'title' => 'Header', 'priority' => 30, ) ); $wp_customize->add_section( 'aleanta_header_settings' , array( 'title' => esc_html__( 'General Settings', 'aleanta' ), 'priority' => 5, 'panel' => 'aleanta_header_panel' ) ); $wp_customize->add_setting( 'aleanta_header_type' , array( 'default' => 'header1', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'aleanta_header_type', array( 'label' => esc_html__( 'Type', 'aleanta' ), 'section' => 'aleanta_header_settings', 'settings' => 'aleanta_header_type', 'type' => 'select', 'choices' => array( 'header1' => esc_html__( 'Classic', 'aleanta' ), 'header2' => esc_html__( 'Shop', 'aleanta' ), 'header3' => esc_html__( 'Sidebar', 'aleanta' ), 'header4' => esc_html__( 'Middle', 'aleanta' ), 'header5' => esc_html__( 'Advanced', 'aleanta' ), ), 'priority' => 10 ) ); /* MIDDLE TYPE */ $wp_customize->add_setting( 'aleanta_header_type4_lmenu' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field' ) ); $args = array( 'taxonomy' => 'nav_menu', 'hide_empty' => true, ); $menus = get_terms( $args ); $menus_arr = array(); $menus_arr[''] = esc_html__( 'Select Menu', 'aleanta' ); foreach ($menus as $key => $value) { if(is_object($value)) { $menus_arr[$value->term_id] = $value->name; } } $wp_customize->add_control( 'aleanta_header_type4_lmenu', array( 'label' => esc_html__( 'Left Menu', 'aleanta' ), 'section' => 'aleanta_header_settings', 'settings' => 'aleanta_header_type4_lmenu', 'type' => 'select', 'choices' => $menus_arr, 'active_callback' => 'aleanta_header_type4_callback', 'priority' => 11, )); $wp_customize->add_setting( 'aleanta_header_type4_rmenu' , array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'aleanta_header_type4_rmenu', array( 'label' => esc_html__( 'Right Menu', 'aleanta' ), 'section' => 'aleanta_header_settings', 'settings' => 'aleanta_header_type4_rmenu', 'type' => 'select', 'choices' => $menus_arr, 'active_callback' => 'aleanta_header_type4_callback', 'priority' => 11 )); /* CREATE TINYMCE FIELD */ class Text_Editor_Custom_Control extends WP_Customize_Control { public $type = 'textarea'; public function render_content() { echo '' . esc_html( $this->label ) . ''; $settings = array( 'media_buttons' => false, 'quicktags' => true, 'textarea_rows' => 5 ); $this->filter_editor_setting_link(); wp_editor($this->value(), $this->id, $settings ); do_action('admin_footer'); do_action('admin_print_footer_scripts'); } private function filter_editor_setting_link() { add_filter( 'the_editor', function( $output ) { return preg_replace( '/