summaryrefslogtreecommitdiff
path: root/template-parts/header/builder/components.php
blob: 8354b5b380af753204fe24cc2ce42b1cc3ace5a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
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;

}
?>