diff options
author | Zach van Rijn <me@zv.io> | 2021-07-21 14:54:07 -0500 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2021-07-21 14:54:07 -0500 |
commit | 9d4123cee1867ee7199b06bdc92d40611f547ecc (patch) | |
tree | 6d864e2725242863afed1f8ba12d9c7a9bc63a69 /template-parts/header/builder | |
download | blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.gz blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.bz2 blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.xz blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.zip |
Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/.
Diffstat (limited to 'template-parts/header/builder')
-rw-r--r-- | template-parts/header/builder/components.php | 195 | ||||
-rw-r--r-- | template-parts/header/builder/desktop-builder-layout.php | 51 | ||||
-rw-r--r-- | template-parts/header/builder/header-row.php | 101 | ||||
-rw-r--r-- | template-parts/header/builder/mobile-builder-layout.php | 46 | ||||
-rw-r--r-- | template-parts/header/builder/mobile-header-row.php | 93 |
5 files changed, 486 insertions, 0 deletions
diff --git a/template-parts/header/builder/components.php b/template-parts/header/builder/components.php new file mode 100644 index 0000000..8354b5b --- /dev/null +++ b/template-parts/header/builder/components.php @@ -0,0 +1,195 @@ +<?php +/** + * Template part for header component. + * + * @package Astra + */ + +if ( astra_wp_version_compare( '5.4.99', '>=' ) ) { + $component_args = wp_parse_args( + $args, + array( + 'type' => '', + 'device' => '', + ) + ); + $component_slug = $component_args['type']; +} else { + $component_slug = get_query_var( 'type' ); +} + +$device = $component_args['device']; + +switch ( $component_slug ) { + + case 'logo': + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item" data-section="title_tagline"> + <?php do_action( 'astra_site_identity' ); ?> + </div> + <?php + break; + + case 'button-1': + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item ast-header-button-1" data-section="section-hb-button-1"> + <?php do_action( 'astra_header_button_1' ); ?> + </div> + <?php + break; + + case 'menu-1': + ?> + <div class="ast-builder-menu-1 ast-builder-menu ast-flex ast-builder-menu-1-focus-item ast-builder-layout-element site-header-focus-item" data-section="section-hb-menu-1"> + <?php do_action( 'astra_header_menu_1' ); ?> + </div> + <?php + break; + + case 'menu-2': + ?> + <div class="ast-builder-menu-2 ast-builder-menu ast-flex ast-builder-menu-2-focus-item ast-builder-layout-element site-header-focus-item" data-section="section-hb-menu-2"> + <?php do_action( 'astra_header_menu_2' ); ?> + </div> + <?php + break; + + case 'mobile-menu': + ?> + <div class="ast-builder-menu-mobile ast-builder-menu ast-builder-menu-mobile-focus-item ast-builder-layout-element site-header-focus-item" data-section="section-header-mobile-menu"> + <?php do_action( 'astra_header_menu_mobile' ); ?> + </div> + <?php + break; + + case 'html-1': + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item ast-header-html-1" data-section="section-hb-html-1"> + <?php do_action( 'astra_header_html_1' ); ?> + </div> + <?php + break; + + case 'html-2': + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item ast-header-html-2" data-section="section-hb-html-2"> + <?php do_action( 'astra_header_html_2' ); ?> + </div> + <?php + break; + + case 'search': + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item ast-header-search" data-section="section-header-search"> + <?php do_action( 'astra_header_search', $args['device'] ); ?> + </div> + <?php + break; + + case 'social-icons-1': + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item" data-section="section-hb-social-icons-1"> + <?php do_action( 'astra_header_social_1' ); ?> + </div> + <?php + break; + + case 'mobile-trigger': + if ( 'desktop' === $device && ! defined( 'ASTRA_EXT_VER' ) ) { + break; + } + ?> + <div class="ast-builder-layout-element ast-flex site-header-focus-item" data-section="section-header-mobile-trigger"> + <?php do_action( 'astra_header_mobile_trigger' ); ?> + </div> + <?php + break; + + case 'account': + ?> + <div class="ast-builder-layout-element site-header-focus-item ast-header-account" data-section="section-header-account"> + <?php do_action( 'astra_header_account' ); ?> + </div> + <?php + break; + + case 'woo-cart': + if ( class_exists( 'Astra_Woocommerce' ) ) { + ?> + <div class="ast-builder-layout-element site-header-focus-item ast-header-woo-cart" data-section="section-header-woo-cart"> + <?php do_action( 'astra_header_woo_cart' ); ?> + </div> + <?php + } + break; + + case 'edd-cart': + if ( class_exists( 'Easy_Digital_Downloads' ) ) { + ?> + <div class="ast-builder-layout-element site-header-focus-item ast-header-edd-cart" data-section="section-header-edd-cart"> + <?php do_action( 'astra_header_edd_cart' ); ?> + </div> + <?php + } + break; + case 'widget-1': + ?> + <aside + <?php + echo astra_attr( + 'header-widget-area-inner', + array( + 'class' => 'header-widget-area widget-area site-header-focus-item', + 'data-section' => 'sidebar-widgets-header-widget-1', + 'aria-label' => 'Header Widget 1', + ) + ); + ?> + > + <?php + if ( is_customize_preview() && class_exists( 'Astra_Builder_UI_Controller' ) ) { + Astra_Builder_UI_Controller::render_customizer_edit_button(); + } + ?> + <?php + astra_markup_open( 'header-widget-div' ); + astra_get_sidebar( 'header-widget-1' ); + astra_markup_close( 'header-widget-div' ); + ?> + </aside> + <?php + break; + case 'widget-2': + ?> + <aside + <?php + echo astra_attr( + 'header-widget-area-inner', + array( + 'class' => 'header-widget-area widget-area site-header-focus-item', + 'data-section' => 'sidebar-widgets-header-widget-2', + 'aria-label' => 'Header Widget 2', + ) + ); + ?> + > + <?php + if ( is_customize_preview() && class_exists( 'Astra_Builder_UI_Controller' ) ) { + Astra_Builder_UI_Controller::render_customizer_edit_button(); + } + ?> + <?php + astra_markup_open( 'header-widget-div' ); + astra_get_sidebar( 'header-widget-2' ); + astra_markup_close( 'header-widget-div' ); + ?> + </aside> + <?php + break; + + default: + do_action( 'astra_render_header_components', $component_slug ); + break; + +} +?> diff --git a/template-parts/header/builder/desktop-builder-layout.php b/template-parts/header/builder/desktop-builder-layout.php new file mode 100644 index 0000000..f16bc97 --- /dev/null +++ b/template-parts/header/builder/desktop-builder-layout.php @@ -0,0 +1,51 @@ +<?php +/** + * Template part for displaying header row. + * + * @package Astra Builder + */ + +$mobile_header_type = astra_get_option( 'mobile-header-type' ); + +if ( 'full-width' === $mobile_header_type ) { + + $mobile_header_type = 'off-canvas'; +} +?> +<div id="ast-desktop-header" data-toggle-type="<?php echo esc_attr( $mobile_header_type ); ?>"> + <?php + astra_main_header_bar_top(); + + /** + * Astra Top Header + */ + do_action( 'astra_above_header' ); + + /** + * Astra Main Header + */ + do_action( 'astra_primary_header' ); + + /** + * Astra Bottom Header + */ + do_action( 'astra_below_header' ); + + astra_main_header_bar_bottom(); + ?> +<?php +if ( 'dropdown' === $mobile_header_type || is_customize_preview() ) { + $content_alignment = astra_get_option( 'header-offcanvas-content-alignment', 'flex-start' ); + $alignment_class = 'content-align-' . $content_alignment . ' '; + ?> + <div class="ast-desktop-header-content <?php echo esc_attr( $alignment_class ); ?>"> + <?php do_action( 'astra_desktop_header_content', 'popup', 'content' ); ?> + </div> +<?php } ?> +</div> <!-- Main Header Bar Wrap --> +<?php +/** + * Astra Mobile Header + */ +do_action( 'astra_mobile_header' ); +?> diff --git a/template-parts/header/builder/header-row.php b/template-parts/header/builder/header-row.php new file mode 100644 index 0000000..127794e --- /dev/null +++ b/template-parts/header/builder/header-row.php @@ -0,0 +1,101 @@ +<?php +/** + * Template part for displaying the a row of the header + * + * @package Astra Builder + */ + +if ( astra_wp_version_compare( '5.4.99', '>=' ) ) { + $row = wp_parse_args( $args, array( 'row' => '' ) ); + $row = $row['row']; +} else { + $row = get_query_var( 'row' ); +} + +if ( Astra_Builder_Helper::is_row_empty( $row, 'header', 'desktop' ) ) { + + $customizer_editor_row = 'section-' . esc_attr( $row ) . '-header-builder'; + $is_transparent_header_enable = astra_get_option( 'transparent-header-enable' ); + + $row_label = ( 'primary' === $row ) ? 'main' : $row; + + ?> + <div class="ast-<?php echo esc_attr( $row_label ); ?>-header-wrap <?php echo 'primary' === $row ? 'main-header-bar-wrap' : ''; ?> "> + <div class="<?php echo esc_attr( 'ast-' . $row . '-header-bar ast-' . $row . '-header' ); ?> <?php echo 'primary' === $row ? 'main-header-bar' : ''; ?> site-header-focus-item" data-section="<?php echo esc_attr( $customizer_editor_row ); ?>"> + <?php + if ( is_customize_preview() ) { + Astra_Builder_UI_Controller::render_grid_row_customizer_edit_button( 'Header', $row ); + } + /** + * Astra Render before Site Content. + */ + do_action( "astra_header_{$row}_container_before" ); + ?> + <div class="site-<?php echo esc_attr( $row ); ?>-header-wrap ast-builder-grid-row-container site-header-focus-item ast-container" data-section="<?php echo esc_attr( $customizer_editor_row ); ?>"> + <div class="ast-builder-grid-row <?php echo Astra_Builder_Helper::has_side_columns( $row ) ? 'ast-builder-grid-row-has-sides' : 'ast-grid-center-col-layout-only ast-flex'; ?> <?php echo Astra_Builder_Helper::has_center_column( $row ) ? 'ast-grid-center-col-layout' : 'ast-builder-grid-row-no-center'; ?>"> + <?php if ( Astra_Builder_Helper::has_side_columns( $row ) ) { ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-left site-header-section ast-flex site-header-section-left"> + <?php + /** + * Astra Render Header Column + */ + do_action( 'astra_render_header_column', $row, 'left' ); + if ( Astra_Builder_Helper::has_center_column( $row ) ) { + ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-left-center site-header-section ast-flex ast-grid-left-center-section"> + <?php + /** + * Astra Render Header Column + */ + do_action( 'astra_render_header_column', $row, 'left_center' ); + ?> + </div> + <?php + } + ?> + </div> + <?php } ?> + <?php if ( Astra_Builder_Helper::has_center_column( $row ) ) { ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-center site-header-section ast-flex ast-grid-section-center"> + <?php + /** + * Astra Render Header Column + */ + do_action( 'astra_render_header_column', $row, 'center' ); + ?> + </div> + <?php } ?> + <?php if ( Astra_Builder_Helper::has_side_columns( $row ) ) { ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-right site-header-section ast-flex ast-grid-right-section"> + <?php + if ( Astra_Builder_Helper::has_center_column( $row ) ) { + ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-right-center site-header-section ast-flex ast-grid-right-center-section"> + <?php + /** + * Astra Render Header Column + */ + do_action( 'astra_render_header_column', $row, 'right_center' ); + ?> + </div> + <?php + } + /** + * Astra Render Header Column + */ + do_action( 'astra_render_header_column', $row, 'right' ); + ?> + </div> + <?php } ?> + </div> + </div> + <?php + /** + * Astra Render after Site Content. + */ + do_action( "astra_header_{$row}_container_after" ); + ?> + </div> + </div> + <?php +} diff --git a/template-parts/header/builder/mobile-builder-layout.php b/template-parts/header/builder/mobile-builder-layout.php new file mode 100644 index 0000000..aa71e68 --- /dev/null +++ b/template-parts/header/builder/mobile-builder-layout.php @@ -0,0 +1,46 @@ +<?php +/** + * Template part for displaying the Mobile Header + * + * @package Astra Builder + */ + +$mobile_header_type = astra_get_option( 'mobile-header-type' ); + +if ( 'full-width' === $mobile_header_type ) { + + $mobile_header_type = 'off-canvas'; +} + +?> +<div id="ast-mobile-header" class="ast-mobile-header-wrap " data-type="<?php echo esc_attr( $mobile_header_type ); ?>"> + <?php + do_action( 'astra_mobile_header_bar_top' ); + + /** + * Astra Top Header + */ + do_action( 'astra_mobile_above_header' ); + + /** + * Astra Main Header + */ + do_action( 'astra_mobile_primary_header' ); + + /** + * Astra Mobile Bottom Header + */ + do_action( 'astra_mobile_below_header' ); + + astra_main_header_bar_bottom(); + ?> +<?php +if ( 'dropdown' === astra_get_option( 'mobile-header-type' ) || is_customize_preview() ) { + $content_alignment = astra_get_option( 'header-offcanvas-content-alignment', 'flex-start' ); + $alignment_class = 'content-align-' . $content_alignment . ' '; + ?> + <div class="ast-mobile-header-content <?php echo esc_attr( $alignment_class ); ?>"> + <?php do_action( 'astra_mobile_header_content', 'popup', 'content' ); ?> + </div> +<?php } ?> +</div> diff --git a/template-parts/header/builder/mobile-header-row.php b/template-parts/header/builder/mobile-header-row.php new file mode 100644 index 0000000..f7e90cd --- /dev/null +++ b/template-parts/header/builder/mobile-header-row.php @@ -0,0 +1,93 @@ +<?php +/** + * Template part for displaying a row of the mobile header + * + * @package Astra Builder + */ + +if ( astra_wp_version_compare( '5.4.99', '>=' ) ) { + + $row = wp_parse_args( $args, array( 'row' => '' ) ); + $row = $row['row']; +} else { + + $row = get_query_var( 'row' ); +} + +if ( Astra_Builder_Helper::is_row_empty( $row, 'header', 'mobile' ) ) { + + $customizer_editor_row = 'section-' . esc_attr( $row ) . '-header-builder'; + $is_transparent_header_enable = astra_get_option( 'transparent-header-enable' ); + + if ( 'primary' === $row && $is_transparent_header_enable ) { + $customizer_editor_row = 'section-transparent-header'; + } + + $row_label = ( 'primary' === $row ) ? 'main' : $row; + ?> + <div class="ast-<?php echo esc_attr( $row_label ); ?>-header-wrap <?php echo 'primary' === $row ? 'main-header-bar-wrap' : ''; ?>" > + <div class="<?php echo esc_attr( 'ast-' . $row . '-header-bar ast-' . $row . '-header ' ); ?><?php echo 'primary' === $row ? 'main-header-bar ' : ''; ?>site-<?php echo esc_attr( $row ); ?>-header-wrap site-header-focus-item ast-builder-grid-row-layout-default ast-builder-grid-row-tablet-layout-default ast-builder-grid-row-mobile-layout-default" data-section="<?php echo esc_attr( $customizer_editor_row ); ?>"> + <?php + if ( is_customize_preview() ) { + Astra_Builder_UI_Controller::render_grid_row_customizer_edit_button( 'Header', $row ); + } + /** + * Astra Render before Site Content. + */ + do_action( "astra_header_{$row}_container_before" ); + ?> + <div class="ast-builder-grid-row <?php echo Astra_Builder_Helper::has_mobile_side_columns( $row, 'header', 'mobile' ) ? 'ast-builder-grid-row-has-sides' : 'ast-grid-center-col-layout-only ast-flex'; ?> <?php echo Astra_Builder_Helper::has_mobile_center_column( $row, 'header', 'mobile' ) ? 'ast-grid-center-col-layout' : 'ast-builder-grid-row-no-center'; ?>"> + <?php if ( Astra_Builder_Helper::has_mobile_side_columns( $row, 'header', 'mobile' ) ) { ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-left site-header-section ast-flex site-header-section-left"> + <?php + /** + * Astra Render Header Column + */ + do_action( 'astra_render_mobile_header_column', $row, 'left' ); + + if ( Astra_Builder_Helper::has_mobile_center_column( $row, 'header', 'mobile' ) ) { + /** + * Astra Render Header Column + */ + do_action( 'astra_render_mobile_header_column', $row, 'left_center' ); + } + ?> + </div> + <?php } ?> + <?php if ( Astra_Builder_Helper::has_mobile_center_column( $row, 'header', 'mobile' ) ) { ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-center site-header-section ast-flex ast-grid-section-center"> + <?php + /** + * Astra Render Header Column + */ + do_action( 'astra_render_mobile_header_column', $row, 'center' ); + ?> + </div> + <?php } ?> + <?php if ( Astra_Builder_Helper::has_mobile_side_columns( $row, 'header', 'mobile' ) ) { ?> + <div class="site-header-<?php echo esc_attr( $row ); ?>-section-right site-header-section ast-flex ast-grid-right-section"> + <?php + if ( Astra_Builder_Helper::has_mobile_center_column( $row, 'header', 'mobile' ) ) { + /** + * Astra Render Header Column + */ + do_action( 'astra_render_mobile_header_column', $row, 'right_center' ); + } + /** + * Astra Render Header Column + */ + do_action( 'astra_render_mobile_header_column', $row, 'right' ); + ?> + </div> + <?php } ?> + </div> + <?php + /** + * Astra Render after Site Content. + */ + do_action( "astra_header_{$row}_container_after" ); + ?> + </div> + </div> + <?php +} |