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; } ?>
>
header_rows as $row ) { if( $this->get_row_data( $row['id'], 'header' ) === NULL ) { continue; } $attributes = $classes = $styles = array(); // Main row class $classes[] = 'bhfb-row-wrapper'; $classes[] = 'bhfb-' . esc_attr( $row['id'] ); // Hide row if there's no component inside $hide_row = (int) $this->is_row_empty( $this->get_row_data( $row['id'], 'header' )->$device ); if( $hide_row ) { $classes[] = 'bt-d-none'; } // Sticky Row if( $sticky_header && $device === 'desktop' ) { if( $row[ 'id' ] === 'main_header_row' && $sticky_row !== 'below-header-row' ) { $classes[] = ' bhfb-sticky-header'; } if( $row[ 'id' ] === 'below_header_row' ) { $classes[] = ' bhfb-sticky-header'; } } // Mount 'class' attribute output $attributes[] = 'class="'. esc_attr( implode( ' ', $classes ) ) .'"'; // Mount 'style' attribute outut $attributes[] = 'style="'. esc_attr( implode( ' ', $styles ) ) .'"'; ?>
> rows_callback( 'header', $row['id'], $device ); ?>
search_form( 'header' ); ?>
mobile_offcanvas_callback( 'mobile_offcanvas' ); ?>
search_form( 'header' ); ?>
0 ) { $empty = false; } } return $empty; } /** * Get columns layout class */ public static function get_columns_layout_class( $val ) { $classes = array(); if( strpos( $val, 'equal' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-equal'; } if( strpos( $val, 'fluid' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-fluid'; } if( strpos( $val, 'bigleft' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-bigleft'; } if( strpos( $val, 'bigright' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-bigright'; } return implode( ' ', $classes ); } /** * Get columns layout class (responsive) */ public static function get_columns_layout_class_responsive( $mod, $default_value ) { $classes = array(); $devices = array( 'desktop', 'tablet' ); foreach( $devices as $device ) { $val = get_theme_mod( $mod . '_' . $device, $default_value ); if( strpos( $val, 'equal' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-equal-' . $device; } if( strpos( $val, 'fluid' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-fluid-' . $device; } if( strpos( $val, 'bigleft' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-bigleft-' . $device; } if( strpos( $val, 'bigright' ) !== FALSE ) { $classes[] = 'bhfb-cols-layout-bigright-' . $device; } } return implode( ' ', $classes ); } /** * Get rows columns layout default customizer value */ public static function get_row_columns_layout_default_customizer_value( $row ) { $default = '3col-equal'; if( $row === 'main_footer_row' ) { $default = '3col-bigleft'; } return $default; } /** * Get rows height default customizer value */ public static function get_row_height_default_customizer_value( $row ) { $default = 100; if( $row === 'main_footer_row' ) { $default = 280; } return $default; } /** * Get rows border default customizer value */ public static function get_row_border_default_customizer_value( $row ) { $default = 0; if( $row === 'below_footer_row' ) { $default = 1; } return $default; } /** * Get rows column default customizer value */ public static function get_row_column_default_customizer_value( $row, $column_id, $setting_id ) { $default = ''; // Vertical Alignment. if( $setting_id === 'vertical_alignment' ) { $default = 'middle'; if( strpos( $row, 'footer' ) !== FALSE ) { $default = 'top'; } } // Inner Layout. if( $setting_id === 'inner_layout' ) { $default = 'inline'; if( strpos( $row, 'footer' ) !== FALSE ) { $default = 'stack'; } } // Horizontal Alignment. if( $setting_id === 'horizontal_alignment' ) { $default = 'start'; if( $row === 'main_header_row' ) { if( $column_id === 2 ) { $default = 'center'; } if( $column_id === 3 ) { $default = 'end'; } } if( $row === 'below_footer_row' && $column_id === 1 ) { $default = 'start'; } } return $default; } /** * Convert CSS value */ public static function convert_column_css_value( $value ) { switch ( $value ) { case 'top': case 'start': $value = 'flex-start'; break; case 'middle': $value = 'center'; break; case 'bottom': case 'end': $value = 'flex-end'; break; case 'stack': $value = 'column'; break; case 'inline': $value = 'row'; break; } return $value; } /** * Convert css alignment props. */ public static function convert_column_css_alignment_prop( $prop, $row, $column ) { // Get 'Inner Layout' to check and convert according to. $default = self::get_row_column_default_customizer_value( $row, $column, 'inner_layout' ); $inner_layout = get_theme_mod( $column . 'inner_layout', $default ); if( $inner_layout === 'stack' ) { if( $prop === 'align-items' ) { $prop = 'justify-content'; } } return $prop; } /** * Generate responsive css output (specific to header/footer builder). */ public static function get_responsive_css( $setting = '', $defaults = array(), $selector = '', $css_prop = '', $unit = 'px', $row = '', $column = '' ) { $devices = array( 'desktop' => '@media (min-width: 1025px)', 'tablet' => '@media (min-width: 576px) and (max-width: 1024px)', 'mobile' => '@media (max-width: 575px)', ); $css = ''; $new_css_prop = ''; // Get 'Inner Layout' default values. $default = self::get_row_column_default_customizer_value( $row, $column, 'inner_layout' ); foreach ( $devices as $device => $media ) { $mod = get_theme_mod( $setting . '_' . $device, $defaults[$device] ); $mod = self::convert_column_css_value( $mod ); if( $row && $column ) { // Get 'Inner Layout' to check and convert according to its value. $inner_layout = get_theme_mod( $column . '_inner_layout' . '_' . $device, $default ); // Stack. if( $inner_layout === 'stack' ) { // Vertical and Horizontal alignment. if( $css_prop === 'align-items' ) { $new_css_prop = 'justify-content'; } elseif( $css_prop === 'justify-content' ) { $new_css_prop = 'align-items'; } // Elements Spacing. if( $css_prop === 'margin-left' ) { $new_css_prop = 'margin-top'; } elseif( $css_prop === 'margin-top' ) { $new_css_prop = 'margin-left'; } // Inline. } elseif( $css_prop === 'margin-top' ) { $new_css_prop = 'margin-left'; } } if( ! $unit ) { $mod = esc_attr( $mod ); $unit = ''; } else { $mod = intval( $mod ); } // If new css prop is empty, then it should reveive the default css prop value. if( ! $new_css_prop ) { $new_css_prop = $css_prop; } $css .= $media . ' { ' . $selector . ' { ' . $new_css_prop . ':' . $mod . $unit . '; } }' . "\n"; } return $css; } /** * Core header image */ public function header_image() { if ( ! get_header_image() ) { return; } // output $output = '
'; /** * Hook 'botiga_header_image_tag' * * @since 1.0.0 */ $output .= apply_filters( 'botiga_header_image_tag', get_header_image_tag() ); $output .= '
'; if ( ! botiga_get_display_conditions( 'header_image_display_conditions', false, '[{"type":"include","condition":"all","id":null}]' ) ) { return; } echo wp_kses_post( $output ); } /** * Require wrapper * To require files with params */ public function require_wrapper( $file_path, $params ) { extract( $params ); require $file_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Primary Menu */ public function menu( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/menu/menu.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Secondary Menu */ public function secondary_menu( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/secondary-menu/secondary-menu.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Social */ public function social( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/'. $params[ 'builder_type' ] .'/social/social.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Search icon */ public function search( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/search/search.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Search form */ public function search_form( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/search/search-form.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Site branding */ public function logo( $params ) { return $this->require_wrapper( get_template_directory() . '/inc/modules/hf-builder/components/'. $params[ 'builder_type' ] .'/logo/logo.php', $params ); } /** * Copyright */ public function copyright( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/footer/copyright/copyright.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Button */ public function button( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/'. $params[ 'builder_type' ] .'/button/button.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Contact Info */ public function contact_info( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/contact-info/contact-info.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * WooCommerce Icons */ public function woo_icons( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/wc-icons/wc-icons.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * HTML */ public function html( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/'. $params[ 'builder_type' ] .'/html/html.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Widget(s) */ public function widget1( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-1/widget.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } public function widget2( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-2/widget.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } public function widget3( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-3/widget.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } public function widget4( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-4/widget.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Mobile menu trigger */ public function mobile_hamburger( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-hamburger/mobile-hamburger.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * Mobile Offcanvas Menu */ public function mobile_offcanvas_menu( $params ) { require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-offcanvas-menu/menu.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } /** * CSS Output */ public static function custom_css() { // We need to require these callbacks here because // this function runs on hooks like "after_switch_theme" (out from customizer) // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require_once get_template_directory() . '/inc/customizer/callbacks.php'; $css = ''; // Header. // Structure Components. require get_template_directory() . '/inc/modules/hf-builder/components/header/header-builder/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/row/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/columns/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-offcanvas/css.php'; // General Components. require get_template_directory() . '/inc/modules/hf-builder/components/header/logo/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/menu/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/secondary-menu/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/search/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/wc-icons/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/social/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/button/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/contact-info/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-hamburger/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/mobile-offcanvas-menu/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/header/html/css.php'; // Footer. // Structure Components. require get_template_directory() . '/inc/modules/hf-builder/components/footer/footer-builder/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/row/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/columns/css.php'; // General Components. require get_template_directory() . '/inc/modules/hf-builder/components/footer/copyright/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/social/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/button/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-1/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-2/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-3/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/widget-4/css.php'; require get_template_directory() . '/inc/modules/hf-builder/components/footer/html/css.php'; // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound /** * Hook 'botiga_hf_builder_custom_css' * * @since 1.0.0 */ return apply_filters( 'botiga_hf_builder_custom_css', $css ); } } /** * Initialize class */ Botiga_Header_Footer_Builder::get_instance();