<?php get_header(); ?>

<!-- ? BLOG AREA STARTS -->

<div class="blog-column">

<!-- BEGIN SLIDER BLOCK -->

<?php

$kindrex_slides = 0;

if ( empty( get_theme_mod( 'kindrex-slider1-image' ) ) ) :
	$kindrex_slider_image_1 = get_template_directory_uri() . '/images/placeholder1.jpg';
else :
	$kindrex_slider_image_1 = wp_get_attachment_url( get_theme_mod( 'kindrex-slider1-image' ) );
endif;

if ( empty( get_theme_mod( 'kindrex-slider2-image' ) ) ) :
	$kindrex_slider_image_2 = get_template_directory_uri() . '/images/placeholder2.jpg';
else :
	$kindrex_slider_image_2 = wp_get_attachment_url( get_theme_mod( 'kindrex-slider2-image' ) );
endif;

?>

<?php if ( get_theme_mod( 'kindrex-slider-display', 'Yes' ) === 'Yes' ) { ?>
	<div class="blog-container">
		<div class="slider">

			<?php if ( '' !== $kindrex_slider_image_1 && get_theme_mod( 'kindrex-slider-display1', 'Yes' ) === 'Yes' ) { ?>
				<div class="slidepics">
					<?php if ( get_theme_mod( 'kindrex-slider1-link' ) !== '' ) { ?>
						<p><a href="<?php echo esc_url( get_theme_mod( 'kindrex-slider1-link' ) ); ?>"><?php echo wp_kses_post( get_theme_mod( 'kindrex-slider1-text' ) ); ?></a></p>
					<?php } else { ?>
						<p><?php echo wp_kses_post( get_theme_mod( 'kindrex-slider1-text' ) ); ?></p>
					<?php } ?>
					<img src="<?php echo esc_attr( $kindrex_slider_image_1 ); ?>">
					<?php $kindrex_slides++; ?>
				</div>
			<?php } ?>
			<?php if ( '' !== $kindrex_slider_image_2 && get_theme_mod( 'kindrex-slider-display2', 'Yes' ) === 'Yes' ) { ?>
				<div class="slidepics">
					<?php if ( get_theme_mod( 'kindrex-slider2-link' ) !== '' ) { ?>
						<p><a href="<?php echo esc_url( get_theme_mod( 'kindrex-slider2-link' ) ); ?>"><?php echo wp_kses_post( get_theme_mod( 'kindrex-slider2-text' ) ); ?></a></p>
					<?php } else { ?>
						<p><?php echo wp_kses_post( get_theme_mod( 'kindrex-slider2-text' ) ); ?></p>
					<?php } ?>
					<img src="<?php echo esc_attr( $kindrex_slider_image_2 ); ?>">
					<?php $kindrex_slides++; ?>
				</div>
			<?php } ?>
			<div class="previous" onclick="previousSlide()"><i class="fa-solid fa-chevron-left"></i></div>
			<div class="next" onclick="nextSlide()"><i class="fa-solid fa-chevron-right"></i></div>

			<?php if ( $kindrex_slides > 0 ) : ?>
			<div id="js-slider-dots" class="slide-dots">
				<?php for ( $kindrex_slide_int = 0; $kindrex_slide_int <= ( $kindrex_slides - 1 ); $kindrex_slide_int++ ) { ?>
					<div onclick="currentSlide(<?php echo ( esc_attr( $kindrex_slide_int ) + 1 ); ?>)" id="slide-<?php echo esc_attr( $kindrex_slide_int ); ?>" class="slide-dot"></div>
				<?php } ?>
			</div>
			<?php endif; ?>
		</div>
	</div>
<?php } ?>

<!-- END SLIDER BLOCK -->

<div id="blog-skip">

<!-- ARTICLES AREA STARS -->

		<?php
		while ( have_posts() ) :
			the_post();
			?>
	<div class="blog-container">
		<div class="story-content">
			<div class="story-pos-1">
				<div class="story-pos-1-inner2">
				<div class="story-pos-1-inner1">
					<h3 class="blog-title">
						<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
					</h3>
				</div>
				</div>
			</div>
			<div class="story-pos-2">
				<div class="story-pos-2-inner">
					<div class="blog-content">
						<div <?php post_class(); ?>>
							<div class="pcontent">

							<?php if ( has_post_thumbnail() ) : ?>
								<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'kindrex-homepage-featured' ); ?></a>
								<div class="vertical-line"></div>
							<?php endif; ?>

							<?php the_excerpt(); ?>
							</div>
							<div id="continuelink">
								<?php /* translators: %s = post title */ ?>
								<a href="<?php the_permalink(); ?>"><?php printf( esc_html__( 'Continue reading %s', 'kindrex' ), wp_kses_post( get_the_title() ) ); ?></a>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="story-pos-3">
				<div class="story-pos-3-inner"></div>
			</div>
			<div class="story-pos-4">
				<div class="story-pos-4-inner">
					<div class="meta-article">
						<span><?php kindrex_post_meta(); ?></span>
					</div>
				</div>
			</div>
			<div class="story-pos-5">
				<div class="story-pos-5-inner1"></div>
				<div class="story-pos-5-inner2"></div>
			</div>
		</div>
	</div>

	<?php endwhile; ?>

<!-- ARTICLE AREA ENDS -->

</div> <!--- Blog Skip End --->

<div class="paginationlink">

<?php
the_posts_pagination(
	array(
		'prev_text' => '&#171; ',
		'next_text' => ' &#187;',

	)
);
?>
</div>

<div id="center-skip">

<!-- BEGIN CENTER BLOCK 1 -->

<?php if ( is_active_sidebar( 'center-block' ) ) : ?>

<div class="blog-container">
	<div class="center-content">
		<div class="content-pos-1">
			<div class="content-pos-1-inner"></div>
		</div>
		<div class="content-pos-2">
			<div class="content-pos-2-inner">
				<div class="centerblk"><?php dynamic_sidebar( 'center-block' ); ?></div>
			</div>
		</div>
		<div class="content-pos-3">
			<div class="content-pos-3-inner"></div>
		</div>
	</div>
</div>
<?php endif; ?>

<!-- END CENTER BLOCK 1 -->

</div> <!--- Center Skip End --->

</div>

<?php get_footer(); ?>
