desktop_components = array( array( 'id' => 'menu', 'label' => esc_html__( 'Primary Menu', 'botiga' ), ), array( 'id' => 'secondary_menu', 'label' => esc_html__( 'Secondary Menu', 'botiga' ), ), array( 'id' => 'social', 'label' => esc_html__( 'Social', 'botiga' ), ), array( 'id' => 'search', 'label' => esc_html__( 'Search', 'botiga' ), ), array( 'id' => 'logo', 'label' => esc_html__( 'Site Identity', 'botiga' ), ), array( 'id' => 'button', 'label' => esc_html__( 'Button', 'botiga' ), ), array( 'id' => 'contact_info', 'label' => esc_html__( 'Contact Info', 'botiga' ), ), array( 'id' => 'html', 'label' => esc_html__( 'HTML', 'botiga' ), ), ); // Mobile components. $this->mobile_components = array( array( 'id' => 'mobile_offcanvas_menu', 'label' => esc_html__( 'Off-Canvas Menu', 'botiga' ), ), array( 'id' => 'secondary_menu', 'label' => esc_html__( 'Secondary Menu', 'botiga' ), ), array( 'id' => 'mobile_hamburger', 'label' => esc_html__( 'Menu Toggle', 'botiga' ), ), array( 'id' => 'social', 'label' => esc_html__( 'Social', 'botiga' ), ), array( 'id' => 'search', 'label' => esc_html__( 'Search', 'botiga' ), ), array( 'id' => 'logo', 'label' => esc_html__( 'Site Identity', 'botiga' ), ), array( 'id' => 'button', 'label' => esc_html__( 'Button', 'botiga' ), ), array( 'id' => 'contact_info', 'label' => esc_html__( 'Contact Info', 'botiga' ), ), array( 'id' => 'html', 'label' => esc_html__( 'HTML', 'botiga' ), ), ); // WooCommerce components. if( class_exists( 'Woocommerce' ) ) { $this->desktop_components[] = array( 'id' => 'woo_icons', 'label' => esc_html__( 'WooCommerce Icons', 'botiga' ), ); $this->mobile_components[] = array( 'id' => 'woo_icons', 'label' => esc_html__( 'WooCommerce Icons', 'botiga' ), ); } // Footer Components. $this->footer_components = array( array( 'id' => 'copyright', 'label' => esc_html__( 'Copyright', 'botiga' ), ), array( 'id' => 'social', 'label' => esc_html__( 'Social', 'botiga' ), ), array( 'id' => 'button', 'label' => esc_html__( 'Button 1', 'botiga' ), ), array( 'id' => 'html', 'label' => esc_html__( 'HTML', 'botiga' ), ), array( 'id' => 'widget1', 'label' => esc_html__( 'Widget Area 1', 'botiga' ), ), array( 'id' => 'widget2', 'label' => esc_html__( 'Widget Area 2', 'botiga' ), ), array( 'id' => 'widget3', 'label' => esc_html__( 'Widget Area 3', 'botiga' ), ), array( 'id' => 'widget4', 'label' => esc_html__( 'Widget Area 4', 'botiga' ), ), ); // Upsell Header Components $this->header_upsell_components = array( array( 'id' => 'button2', 'label' => esc_html__( 'Button 2', 'botiga' ), ), array( 'id' => 'html2', 'label' => esc_html__( 'HTML 2', 'botiga' ), ), array( 'id' => 'social', 'label' => esc_html__( 'Login/Register', 'botiga' ), ), ); // Upsell Footer Components $this->footer_upsell_components = array( array( 'id' => 'footer_menu', 'label' => esc_html__( 'Footer Menu', 'botiga' ), ), array( 'id' => 'html2', 'label' => esc_html__( 'HTML 2', 'botiga' ), ), array( 'id' => 'button2', 'label' => esc_html__( 'Button 2', 'botiga' ), ), ); // Header Rows Options $this->header_rows = array( array( 'id' => 'above_header_row', 'label' => esc_html__( 'Top Row', 'botiga' ), 'description' => esc_html__( 'The settings from the first row from header builder.', 'botiga' ), 'section' => 'botiga_section_hb_above_header_row', 'default' => $this->get_row_default_value( 'above_header_row' ), ), array( 'id' => 'main_header_row', 'label' => esc_html__( 'Main Row', 'botiga' ), 'description' => esc_html__( 'The settings from the second row from header builder.', 'botiga' ), 'section' => 'botiga_section_hb_main_header_row', 'default' => $this->get_row_default_value( 'main_header_row' ), ), array( 'id' => 'below_header_row', 'label' => esc_html__( 'Bottom Row', 'botiga' ), 'description' => esc_html__( 'The settings from the third row from header builder.', 'botiga' ), 'section' => 'botiga_section_hb_below_header_row', 'default' => $this->get_row_default_value( 'below_header_row' ), ), ); // Footer Rows Options $this->footer_rows = array( array( 'id' => 'above_footer_row', 'label' => esc_html__( 'Top Row', 'botiga' ), 'description' => esc_html__( 'The settings from the first row from footer builder.', 'botiga' ), 'section' => 'botiga_section_fb_above_footer_row', 'default' => $this->get_row_default_value( 'above_footer_row' ), ), array( 'id' => 'main_footer_row', 'label' => esc_html__( 'Main Row', 'botiga' ), 'description' => esc_html__( 'The settings from the second row from footer builder.', 'botiga' ), 'section' => 'botiga_section_fb_main_footer_row', 'default' => $this->get_row_default_value( 'main_footer_row' ), ), array( 'id' => 'below_footer_row', 'label' => esc_html__( 'Bottom Row', 'botiga' ), 'description' => esc_html__( 'The settings from the third row from footer builder.', 'botiga' ), 'section' => 'botiga_section_fb_below_footer_row', 'default' => $this->get_row_default_value( 'below_footer_row' ), ), ); if( is_customize_preview() ) { add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); } add_action( 'customize_preview_init', array( $this, 'customize_preview_scripts' ) ); // The order '1000' is required here to make sure BP features will be registered as well. add_action( 'customize_register', array( $this, 'customizer_options' ), 1000 ); add_action( 'customize_controls_print_footer_scripts', function(){ $this->header_builder_admin_grid( 'header' ); } ); add_action( 'customize_controls_print_footer_scripts', function(){ $this->header_builder_admin_grid( 'footer' ); } ); add_action( 'customize_controls_print_footer_scripts', function() { echo ''; }); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_filter( 'body_class', array( $this, 'body_class' ) ); remove_all_actions( 'botiga_header' ); add_action( 'botiga_header', array( $this, 'header_front_output' ) ); remove_all_actions( 'botiga_footer' ); add_action( 'botiga_footer', array( $this, 'footer_front_output' ) ); // Header Image (customize > header > header image) add_action( 'botiga_header', array( $this, 'header_image' ), 30 ); } /** * Enqueue Admin Scripts */ public function admin_enqueue_scripts() { wp_enqueue_script( 'jquery-ui-sortable' ); wp_enqueue_style( 'botiga-bhfb', get_template_directory_uri() . '/assets/css/admin/botiga-bhfb.min.css', array(), BOTIGA_VERSION ); wp_enqueue_script( 'botiga-bhfb', get_template_directory_uri() . '/assets/js/admin/botiga-bhfb.min.js', array(), BOTIGA_VERSION, true ); wp_localize_script( 'botiga-bhfb', 'botiga_hfb', array( 'rows' => array( 'defaults' => array( 'above_header_row' => $this::get_row_default_value( 'above_header_row' ), 'main_header_row' => $this::get_row_default_value( 'main_header_row' ), 'below_header_row' => $this::get_row_default_value( 'below_header_row' ), 'mobile_offcanvas' => $this::get_row_default_value( 'mobile_offcanvas' ), 'above_footer_row' => $this::get_row_default_value( 'above_footer_row' ), 'main_footer_row' => $this::get_row_default_value( 'main_footer_row' ), 'below_footer_row' => $this::get_row_default_value( 'below_footer_row' ), ), ), 'components' => array( /** * Hook 'botiga_header_builder_desktop_components' * * @since 1.0.0 */ 'desktop' => apply_filters( 'botiga_header_builder_desktop_components', $this->desktop_components ), /** * Hook 'botiga_header_builder_mobile_components' * * @since 1.0.0 */ 'mobile' => apply_filters( 'botiga_header_builder_mobile_components', $this->mobile_components ), /** * Hook 'botiga_header_builder_footer_components' * * @since 1.0.0 */ 'footer' => apply_filters( 'botiga_header_builder_footer_components', $this->footer_components ), ), 'upsell_components' => array( 'enable' => ! defined( 'BOTIGA_AWL_ACTIVE' ) && ! defined( 'BOTIGA_PRO_VERSION' ) ? true : false, /** * Hook 'botiga_header_builder_upsell_components' * * @since 1.0.0 */ 'header' => apply_filters( 'botiga_header_builder_upsell_components', $this->header_upsell_components ), /** * Hook 'botiga_header_builder_footer_upsell_components' * * @since 1.0.0 */ 'footer' => apply_filters( 'botiga_header_builder_footer_upsell_components', $this->footer_upsell_components ), 'title' => esc_html__( 'PRO Components', 'botiga' ), 'total' => esc_html__( '13+ Components Available', 'botiga' ), 'button' => esc_html__( 'Get Botiga Pro Now!', 'botiga' ), 'link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_medium=button&utm_campaign=Botiga', ), 'header_presets' => $this->header_presets_values(), 'i18n' => array( 'elementsMessage' => esc_html__( 'It looks like you already are using all available components.', 'botiga' ), ), ) ); } /** * Enqueue Customize Preview Scripts. */ public function customize_preview_scripts() { wp_enqueue_style( 'botiga-bhfb-customize-preview', get_template_directory_uri() . '/assets/css/admin/botiga-bhfb-customize-preview.min.css', array(), BOTIGA_VERSION ); wp_enqueue_script( 'botiga-bhfb-customize-preview', get_template_directory_uri() . '/assets/js/admin/botiga-bhfb-customize-preview.min.js', array(), BOTIGA_VERSION, true ); } /** * Enqueue Front Scripts. */ public function enqueue_scripts() { wp_enqueue_style( 'botiga-bhfb', get_template_directory_uri() . '/assets/css/botiga-bhfb.min.css', array(), BOTIGA_VERSION ); } /** * Body Class Callback */ public function body_class( $classes ) { $classes[] = 'has-bhfb-builder'; return $classes; } /** * Register Customizer Header/Footer Builder Options */ public function customizer_options( $wp_customize ) { $this->header_customizer_options( $wp_customize ); $this->footer_customizer_options( $wp_customize ); } /** * Header Customizer Options */ public function header_customizer_options( $wp_customize ) { // Remove sections $wp_customize->remove_section('botiga_section_top_bar'); $wp_customize->remove_section('botiga_section_main_header'); $wp_customize->remove_section('botiga_section_mobile_header'); $wp_customize->remove_section('botiga_section_header_icons'); // Header Builder Wrapper $wp_customize->add_section( 'botiga_section_hb_wrapper', array( 'title' => esc_html__( 'Header Builder', 'botiga' ), 'description' => esc_html__( 'Powerful drag and drop tool to build your own header.', 'botiga' ), 'panel' => 'botiga_panel_header', ) ); // Header Builder Top Header Row Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_hb_above_header_row', array( 'title' => esc_html__( 'Top Row', 'botiga' ), 'description' => esc_html__( 'The settings from the first row from header builder.', 'botiga' ), 'panel' => 'botiga_panel_header', ) ) ); // Header Builder Main Header Row Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_hb_main_header_row', array( 'title' => esc_html__( 'Main Row', 'botiga' ), 'description' => esc_html__( 'The settings from the second row from header builder.', 'botiga' ), 'panel' => 'botiga_panel_header', ) ) ); // Header Builder Bottom Header Row Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_hb_below_header_row', array( 'title' => esc_html__( 'Bottom Row', 'botiga' ), 'description' => esc_html__( 'The settings from the third row from header builder.', 'botiga' ), 'panel' => 'botiga_panel_header', ) ) ); // Header Builder Mobile Offcanvas Header Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_hb_mobile_offcanvas', array( 'title' => esc_html__( 'Mobile Offcanvas', 'botiga' ), 'description' => esc_html__( 'The settings from the mobile offcanvas from header builder.', 'botiga' ), 'panel' => 'botiga_panel_header', ) ) ); // Components // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require get_template_directory() . '/inc/modules/hf-builder/components/header/button/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/contact-info/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/menu/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/secondary-menu/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/social/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/search/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/logo/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/wc-icons/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/html/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-hamburger/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-offcanvas-menu/customize-options.php'; // Structure Components. require get_template_directory() . '/inc/modules/hf-builder/components/header/header-builder/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/row/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/columns/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-offcanvas/customize-options.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } public function footer_customizer_options( $wp_customize ) { // Remove sections $wp_customize->remove_section('botiga_section_footer_widgets'); $wp_customize->remove_section('botiga_section_footer_credits'); // Footer Builder Wrapper $wp_customize->add_section( 'botiga_section_fb_wrapper', array( 'title' => esc_html__( 'Footer Builder', 'botiga' ), 'description' => esc_html__( 'Powerful drag and drop tool to build your own footer.', 'botiga' ), 'panel' => 'botiga_panel_footer', ) ); // Footer Builder Top Footer Row Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_fb_above_footer_row', array( 'title' => esc_html__( 'Top Row', 'botiga' ), 'description' => esc_html__( 'The settings from the first row from footer builder.', 'botiga' ), 'panel' => 'botiga_panel_footer', ) ) ); // Footer Builder Main Footer Row Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_fb_main_footer_row', array( 'title' => esc_html__( 'Main Row', 'botiga' ), 'description' => esc_html__( 'The settings from the second row from footer builder.', 'botiga' ), 'panel' => 'botiga_panel_footer', ) ) ); // Footer Builder Bottom Footer Row Section $wp_customize->add_section( new Botiga_Section_Hidden( $wp_customize, 'botiga_section_fb_below_footer_row', array( 'title' => esc_html__( 'Bottom Row', 'botiga' ), 'description' => esc_html__( 'The settings from the third row from footer builder.', 'botiga' ), 'panel' => 'botiga_panel_footer', ) ) ); // Components. // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require get_template_directory() . '/inc/modules/hf-builder/components/footer/social/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/copyright/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/button/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/html/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-1/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-2/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-3/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-4/customize-options.php'; // Structure Components. require get_template_directory() . '/inc/modules/hf-builder/components/footer/footer-builder/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/row/customize-options.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/columns/customize-options.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Header Presets Values */ public function header_presets_values() { return array( 'header_layout_1' => array( 'above_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', 'main_row' => '{ "desktop": [["menu"], ["logo"], ["search","woo_icons"]], "mobile": [["mobile_hamburger"], ["logo"], ["search", "woo_icons"]], "mobile_offcanvas": [["mobile_offcanvas_menu"]] }', 'below_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', ), 'header_layout_2' => array( 'above_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', 'main_row' => '{ "desktop": [["logo"], ["menu","search","woo_icons"]], "mobile": [["mobile_hamburger"], ["logo"], ["search", "woo_icons"]], "mobile_offcanvas": [["mobile_offcanvas_menu"]] }', 'below_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', ), 'header_layout_3' => array( 'above_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', 'main_row' => '{ "desktop": [["search"], ["logo"], ["woo_icons"]], "mobile": [["mobile_hamburger"], ["logo"], ["search", "woo_icons"]], "mobile_offcanvas": [["mobile_offcanvas_menu"]] }', 'below_row' => '{ "desktop": [["menu"]], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', ), 'header_layout_4' => array( 'above_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', 'main_row' => '{ "desktop": [["logo"], ["search"]], "mobile": [["mobile_hamburger"], ["logo"], ["search", "woo_icons"]], "mobile_offcanvas": [["mobile_offcanvas_menu"]] }', 'below_row' => '{ "desktop": [["menu"],["woo_icons"]], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', ), 'header_layout_5' => array( 'above_row' => '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', 'main_row' => '{ "desktop": [["search"], ["logo"], ["woo_icons"]], "mobile": [["mobile_hamburger"], ["logo"], ["search", "woo_icons"]], "mobile_offcanvas": [["mobile_offcanvas_menu"]] }', 'below_row' => '{ "desktop": [["menu"],["button"]], "mobile": [[], [], []], "mobile_offcanvas": [[]] }', ), ); } /** * Get Row Data */ public static function get_row_data( $row, $area ) { if( $area === 'footer' ) { return json_decode( get_theme_mod( 'botiga_footer_row__' . $row, Botiga_Header_Footer_Builder::get_row_default_value( $row ) ) ); } return json_decode( get_theme_mod( 'botiga_header_row__' . $row, Botiga_Header_Footer_Builder::get_row_default_value( $row ) ) ); } /** * Get Row Default Value */ public static function get_row_default_value( $row ) { switch ( $row ) { case 'main_header_row': if( class_exists( 'Woocommerce' ) ) { $default = '{ "desktop": [["menu"], ["logo"], ["search", "woo_icons"]], "mobile": [["search"], ["logo"], ["woo_icons", "mobile_hamburger"]] }'; } else { $default = '{ "desktop": [["menu"], ["logo"], ["search"]], "mobile": [["search"], ["logo"], ["mobile_hamburger"]] }'; } break; case 'mobile_offcanvas': $default = '{ "desktop": [], "mobile": [], "mobile_offcanvas": [["mobile_offcanvas_menu"]] }'; break; case 'main_footer_row': $default = '{ "desktop": [[], [], []], "mobile": [[], [], []] }'; break; case 'below_footer_row': $default = '{ "desktop": [["copyright"]], "mobile": [[], [], []] }'; break; default: $default = '{ "desktop": [[], [], []], "mobile": [[], [], []], "mobile_offcanvas": [[]] }'; break; } return $default; } /** * Row Output */ public function rows_callback( $area, $row, $device ) { $args = array( 'area' => $area, 'row' => $row, 'device' => $device, 'row_data' => $this->get_row_data( $row, $area ), ); if( 'header' === $area ) { botiga_get_template_part( 'template-parts/header-builder/content', 'header-row', $args ); } if( 'footer' === $area ) { botiga_get_template_part( 'template-parts/footer-builder/content', 'footer-row', $args ); } } /** * Mobile Offcanvas Output */ public function mobile_offcanvas_callback() { $args = array( 'row_data' => json_decode( get_theme_mod( 'botiga_header_row__mobile_offcanvas', $this->get_row_default_value( 'mobile_offcanvas' ) ) ), ); botiga_get_template_part( 'template-parts/header-builder/content', 'header-mobile-offcanvas', $args ); } /** * Edit icon inside customizer. */ public static function customizer_edit_button() { if( !is_customize_preview() ) { return; } ?>