<?php
// Display on selected pages only
$ishide = maglume_area_ishide( 'below_sitehead' );
if ( $ishide ) { return; }

// Get Content
hoot_set_data( 'below_sitehead_left', is_active_sidebar( 'hoot-below-sitehead-left' ) );
hoot_set_data( 'below_sitehead_right', is_active_sidebar( 'hoot-below-sitehead-right' ) );

// Template modification Hook
do_action( 'maglume_before_below_sitehead' );

// Display Below sitehead
$hoot_below_sitehead_left = hoot_data()->below_sitehead_left;
$hoot_below_sitehead_right = hoot_data()->below_sitehead_right;
$hoot_below_sitehead_align = hoot_get_mod( 'below_sitehead_align' );

if ( !empty( $hoot_below_sitehead_left ) || !empty( $hoot_below_sitehead_right ) ) :
	$scheme = hoot_get_mod( 'belowsh_scheme' );
	$schemeclass = $scheme == 'dark' || $scheme == 'light' || $scheme == 'custom' ? ' below-sitehead-scheme below-sitehead-'.$scheme : '';

	$below_sitehead_grid = ( hoot_get_mod( 'below_sitehead_grid' ) == 'stretch' ) ? ' below-sitehead-stretch' : ' below-sitehead-boxed';

	?>
	<div <?php hoot_attr( 'below-sitehead', '', 'inline-nav js-search' . $below_sitehead_grid . $schemeclass ); ?>>
		<div class="hgrid">
			<div class="hgrid-span-12">

				<div class="below-sitehead-inner hootflex <?php if ( $hoot_below_sitehead_align === 'center' ) echo 'hootflex-center'; ?>">
					<?php
					if ( $hoot_below_sitehead_left ):
						$below_siteheadid = $hoot_below_sitehead_align === 'leftright' ? 'left' : 'center';

						// Template modification Hook
						do_action( 'maglume_sidebar_start', 'below-sitehead-left', $below_siteheadid );
						?>

						<div id="below-sitehead-left" class="below-sitehead-part below-sitehead-<?php echo $below_siteheadid; ?>">
							<?php dynamic_sidebar( 'hoot-below-sitehead-left' ); ?>
						</div>

						<?php
						// Template modification Hook
						do_action( 'maglume_sidebar_end', 'below-sitehead-left', $below_siteheadid );

					endif;

					if ( $hoot_below_sitehead_right ):
						$below_siteheadid = $hoot_below_sitehead_align === 'leftright' ? 'right' : 'center';

						// Template modification Hook
						do_action( 'maglume_sidebar_start', 'below-sitehead-right', $below_siteheadid );
						?>

						<div id="below-sitehead-right" class="below-sitehead-part below-sitehead-<?php echo $below_siteheadid; ?>">
							<?php dynamic_sidebar( 'hoot-below-sitehead-right' ); ?>
						</div>

						<?php
						// Template modification Hook
						do_action( 'maglume_sidebar_end', 'below-sitehead-right', $below_siteheadid );

					endif;
					?>
				</div>

			</div>
		</div>
	</div>
	<?php

endif;

// Template modification Hook
do_action( 'maglume_after_below_sitehead' );