<?php
/**
 * Template part for displaying Hero Content
 *
 * @package Weddi_Pro
 */
if ( ! weddi_pro_gtm( 'weddi_pro_hero_content_page' ) ) {
	return;
}

$weddi_pro_args = array(
	'page_id'        => absint( weddi_pro_gtm( 'weddi_pro_hero_content_page' ) ),
	'posts_per_page' => 1,
	'post_type'      => 'page',
);

$weddi_pro_loop = new WP_Query( $weddi_pro_args );

while ( $weddi_pro_loop->have_posts() ) :
	$weddi_pro_loop->the_post();

	$weddi_pro_content_align = weddi_pro_gtm( 'weddi_pro_hero_content_position' );
	$weddi_pro_text_align    = weddi_pro_gtm( 'weddi_pro_hero_content_text_align' );
	$weddi_pro_subtitle      = weddi_pro_gtm( 'weddi_pro_hero_content_custom_subtitle' );

	$classes[] = 'hero-content-section section';
	$classes[] = weddi_pro_gtm( 'weddi_pro_hero_content_position' );
	$classes[] = weddi_pro_gtm( 'weddi_pro_hero_content_text_align' );

	if ( ! has_post_thumbnail() ) {
		$classes[] = 'thumbnail-disable';
	}
	?>

	<div id="hero-content-section" class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
		<div class="section-featured-page">
			<div class="container">
				<div class="row">
					<div class="hero-content-wrapper">
						<?php if ( has_post_thumbnail() ) : ?>
						<div class="ff-grid-6 featured-page-thumb">
							<div class=" featured-page-thumb-wrapper"><?php the_post_thumbnail( 'weddi-pro-hero', array( 'class' => 'alignnone' ) );?>
						</div>
						</div>
						<?php endif; ?>

						<!-- .ff-grid-6 -->
						<div class="ff-grid-6 featured-page-content">
							<div class="featured-page-section">
								<div class="section-title-wrap text-alignleft">
									<?php if ( $weddi_pro_subtitle ) : ?>
									<p class="section-top-subtitle"><?php echo esc_html( $weddi_pro_subtitle ); ?></p>
									<?php endif; ?>

									<?php the_title( '<h2 class="section-title">', '</h2>' ); ?>

									<span class="divider"></span>
								</div>

								<?php weddi_pro_display_content( 'hero_content' ); ?>
							</div><!-- .featured-page-section -->
						</div><!-- .ff-grid-6 -->
					</div><!-- .hero-content-wrapper -->

				</div><!-- .row -->
			</div><!-- .container -->
		</div><!-- .section-featured-page -->
	</div><!-- .section -->
<?php
endwhile;

wp_reset_postdata();
