<?php get_header(); ?>
	<div class="content page">
			<div id="page-" class="page-content">
				<section class="l-hero-blog">
                <?php
                    $args = array(
                        'post_type'      => 'post',
                        'posts_per_page' => 1,
                        'post_status' => 'publish',
                        'meta_key' => 'featured_post',
                        'meta_value' => 1

                    
                    );
                    $loop = new WP_Query( $args );


                    if ( $loop->have_posts() ):
                        ?>
                    <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                            <?php
                                $post_id = get_the_ID();
                                $imagefeatured = get_the_post_thumbnail_url($post_id,'featured-index');
                            ?>
					<div class="l-hero-blog__image">
						<img src="<?php echo $imagefeatured; ?>" alt="<?php echo the_title(); ?>">
						<a href="<?php the_permalink(); ?>" class="c-hero-blog-btn is-light">Read</a>
					</div>
                    <?php
                        endwhile; wp_reset_query();
                    endif;
                    ?>
					<div class="l-hero-blog__content">
                    <?php
                        $args = array(
                            'post_type'      => 'post',
                            'posts_per_page' => 1,
                            'post_status' => 'publish',
                            'meta_key' => 'featured_post',
                            'meta_value' => 1

                        
                        );
                        $loop = new WP_Query( $args );


                        if ( $loop->have_posts() ):
                            ?>
                        <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                                <?php
                                    $categories = get_the_category();
                                    $author = get_field('author_news');
                                ?>
                        <article class="c-card-featured">
                            <p class="c-card-featured__meta"><?php echo get_the_date('M'); ?> <?php echo get_the_date('d'); ?>, <?php echo get_the_date('Y'); ?> · <?php echo '<a href="'. esc_url( home_url( '/category/' ) ) . $categories[0]->slug .'">'.$categories[0]->name; ?></a> · <?php echo prefix_estimated_reading_time( get_the_content() ); ?> min read</p>
                            <a href="<?php the_permalink(); ?>">
                                <h3 class="c-card-featured__title feature-title"><?php echo the_title(); ?></h3>
                            </a>
                            <p class="c-card-featured__description"><?php $excerpt= get_the_excerpt(); $excerpt=strip_tags($excerpt); echo $excerpt; ?></p>
                            <div class="c-card-author">
                                <p><?php echo $author["user_avatar"]; ?><?php echo $author["user_firstname"]; ?></p>
                            </div>
                        </article>
                        <?php
                            endwhile; wp_reset_query();
                            endif;
                        ?>
                            <?php
                                $args = array(
                                    'post_type'      => 'post',
                                    'posts_per_page' => 2,
                                    'offset' => 1,
                                    'post_status' => 'publish',
                                    'meta_key' => 'featured_post',
                                    'meta_value' => 1

                                
                                );
                                $loop = new WP_Query( $args );


                                if ( $loop->have_posts() ):
                            ?>
                        <div class="c-related-post">
                            <h3 class="c-related-post__title">Related</h3>
                            <div class="c-related-post__row owl-carousel">
                                <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                                        <?php
                                            $categories = get_the_category();
                                            $post_id = get_the_ID();
                                            $imagefeatured = get_the_post_thumbnail_url($post_id,'related-index');
                                            $format = get_post_format( $post_id );
                                            if(!$format):
                                                $format = "article";
                                            endif;
                                        ?>

                                <article class="c-card-news">
                                    <div class="c-featured-news">
                                        <a href="<?php the_permalink(); ?>">
                                            <img src="<?php echo $imagefeatured; ?>" alt="<?php echo the_title(); ?>">
                                            <div class="c-card-news__type"><i class="icon icon-<?php echo $format; ?>"></i></div>
                                        </a>
                                    </div>
                                    <p class="c-featured-news__meta"><?php echo get_the_date('M'); ?> <?php echo get_the_date('d'); ?>, <?php echo get_the_date('Y'); ?> · <?php echo '<a href="'. esc_url( home_url( '/category/' ) ) . $categories[0]->slug .'">'.$categories[0]->name; ?></a> · <?php echo prefix_estimated_reading_time( get_the_content() ); ?> min read</p>
                                    <a href="<?php the_permalink(); ?>">
                                        <h3 class="c-featured-news__title"><?php echo the_title(); ?></h3>
                                    </a>
                                </article>
                                <?php
                                    endwhile; wp_reset_query();
                                ?>
                            </div>
                        </div>
                        <?php
                            endif;
                        ?>
					</div>
				</section>
			</div><!-- .page-content -->
            <?php
            
                $args = array(
                    'post_type'      => 'post',
                    'posts_per_page' => 12,
                    'post_status' => 'publish',
                
                );
                $loop = new WP_Query( $args );


                if ( $loop->have_posts() ):
                    ?>
		<section class="l-brands-news l-brands-latest py-3 py-md-3 py-xl-4">
                <div class="carousel-title d-flex justify-content-between align-items-center mb-md-1 mb-xl-3">
                    <h2 class="c-subtitle is-center is-dark">Latest News <a class="c-subtitle__link" href="<?php echo esc_url( home_url( '/blog-press/all' ) ); ?>">View all</a></h2>

                    <div class="d-none d-sm-flex">
                        <a href="javascript:;" class="c-btn-round is-dark js-carousel-news-prev" aria-label="Prev"><i class="icon icon-left-arrow"></i></a>
                        <a href="javascript:;" class="c-btn-round is-dark js-carousel-news-next" aria-label="Next"><i class="icon icon-right-arrow"></i></a>
                    </div>
                </div>
                <div class="c-carousel-news js-carousel-news owl-carousel">
                <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                        <?php
                            $categories = get_the_category();
                            $post_id = get_the_ID();
                            $imagefeatured = get_the_post_thumbnail_url($post_id,'full');
                            $imagefeaturedmobile = get_the_post_thumbnail_url($post_id, 'list-archive');
                            $format = get_post_format( $post_id );
                            if(!$format):
                                $format = "article";
                            endif;
                        ?>
                        <article class="c-card-news">
                            <div class="c-card-news__cover">
                                <a class="c-card-news__link" href="<?php the_permalink(); ?>">
                                    <picture class="c-card-news__image">
                                        <source media="(max-width: 1200px)" srcset="<?php echo $imagefeaturedmobile; ?>">
                                        <img src="<?php echo $imagefeatured; ?>" alt="<?php echo the_title(); ?>">
                                    </picture>
                                    <div class="c-card-news__type"><i class="icon icon-<?php echo $format; ?>"></i></div>
                                </a>
                            </div>
                            <p class="c-card-news__meta is-dark"><?php echo get_the_date('M'); ?> <?php echo get_the_date('d'); ?>, <?php echo get_the_date('Y'); ?> · <?php echo '<a href="'. esc_url( home_url( '/category/' ) ) . $categories[0]->slug .'">'.$categories[0]->name; ?></a> · <?php echo prefix_estimated_reading_time( get_the_content() ); ?> min read</p>
                            <a href="<?php the_permalink(); ?>">
                                <h3 class="c-card-news__title is-dark"><?php echo the_title(); ?></h3>
                            </a>
                        </article>
                    <?php
                        endwhile; wp_reset_query();
                    ?>
                </div>
        </section>
        <?php
            endif;
        ?>
        <?php
            
                    $args = array(
                        'post_type'      => 'post',
                        'posts_per_page' => 12,
                        'post_status' => 'publish',
                        'category_name' => 'technology'
                    
                    );
                    $loop = new WP_Query( $args );


                    if ( $loop->have_posts() ):
                        ?>
		<section class="l-brands-news l-brands-technology py-3 py-md-3 py-xl-4">
                <div class="carousel-title d-flex justify-content-between align-items-center mb-md-1 mb-xl-3">
                    <h2 class="c-subtitle is-center is-tech">Technology <a class="c-subtitle__link" href="<?php echo esc_url( home_url( '/category/technology' ) ); ?>">View all</a></h2>

                    <div class="d-none d-sm-flex">
                        <a href="javascript:;" class="c-btn-round is-tech js-carousel-default-prev" aria-label="Prev"><i class="icon icon-left-arrow"></i></a>
                        <a href="javascript:;" class="c-btn-round is-tech js-carousel-default-next" aria-label="Next"><i class="icon icon-right-arrow"></i></a>
                    </div>
                </div>
                <div class="c-carousel-default js-carousel-default owl-carousel">
                    <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                            <?php
                                $categories = get_the_category();
                                $post_id = get_the_ID();
                                $imagefeatured = get_the_post_thumbnail_url($post_id,'full');
                                $imagefeaturedmobile = get_the_post_thumbnail_url($post_id, 'list-archive');
                                $format = get_post_format( $post_id );
                                if(!$format):
                                    $format = "article";
                                endif;
                            ?>
                        <article class="c-card-news">
                            <div class="c-card-news__cover">
                                <a class="c-card-news__link" href="<?php the_permalink(); ?>">
                                    <picture class="c-card-news__image">
                                        <source media="(max-width: 1200px)" srcset="<?php echo $imagefeaturedmobile; ?>">
                                        <img src="<?php echo $imagefeatured; ?>" alt="<?php echo the_title(); ?>">
                                    </picture>
                                    <div class="c-card-news__type"><i class="icon icon-<?php echo $format; ?>"></i></div>
                                </a>
                            </div>
                            <p class="c-card-news__meta is-tech"><?php echo get_the_date('M'); ?> <?php echo get_the_date('d'); ?>, <?php echo get_the_date('Y'); ?> · <?php echo '<a href="'. esc_url( home_url( '/category/' ) ) . $categories[0]->slug .'">'.$categories[0]->name; ?></a> · <?php echo prefix_estimated_reading_time( get_the_content() ); ?> min read</p>
                            <a href="<?php the_permalink(); ?>">
                                <h3 class="c-card-news__title is-tech"><?php echo the_title(); ?></h3>
                            </a>
                        </article>
                    <?php
                        endwhile; wp_reset_query();
                    ?>
                </div>
        </section>
        <?php
                        endif;
                    ?>
        <?php
            
                    $args = array(
                        'post_type'      => 'post',
                        'posts_per_page' => 12,
                        'post_status' => 'publish',
                        'category_name' => 'in-the-press'
                    
                    );
                    $loop = new WP_Query( $args );


                    if ( $loop->have_posts() ):
                        ?>
		<section class="l-brands-news py-3 py-md-3 py-xl-4">
                <div class="carousel-title d-flex justify-content-between align-items-center mb-md-1 mb-xl-3">
                    <h2 class="c-subtitle is-center">In The Press <a class="c-subtitle__link" href="<?php echo esc_url( home_url( '/category/in-the-press' ) ); ?>">View all</a></h2>

                    <div class="d-none d-sm-flex">
                        <a href="javascript:;" class="c-btn-round js-carousel-press-prev" aria-label="Prev"><i class="icon icon-left-arrow"></i></a>
                        <a href="javascript:;" class="c-btn-round js-carousel-press-next" aria-label="Next"><i class="icon icon-right-arrow"></i></a>
                    </div>
                </div>
                <div class="c-carousel-press js-carousel-press owl-carousel">
                    <?php while ( $loop->have_posts() ) : $loop->the_post();?>
                            <?php
                                $categories = get_the_category();
                                $post_id = get_the_ID();
                                $imagefeatured = get_the_post_thumbnail_url($post_id,'full');
                                $imagefeaturedmobile = get_the_post_thumbnail_url($post_id, 'list-archive');
                                $format = get_post_format( $post_id );
                                if(!$format):
                                    $format = "article";
                                endif;
                            ?>
                    
                        <article class="c-card-news">
                            <div class="c-card-news__cover">
                                <a class="c-card-news__link" href="<?php the_permalink(); ?>">
                                    <picture class="c-card-news__image">
                                        <source media="(max-width: 1200px)" srcset="<?php echo $imagefeaturedmobile; ?>">
                                        <img src="<?php echo $imagefeatured; ?>" alt="<?php echo the_title(); ?>">
                                    </picture>
                                    <div class="c-card-news__type"><i class="icon icon-<?php echo $format; ?>"></i></div>
                                </a>
                            </div>
                            <p class="c-card-news__meta"><?php echo get_the_date('M'); ?> <?php echo get_the_date('d'); ?>, <?php echo get_the_date('Y'); ?> · <?php echo '<a href="'. esc_url( home_url( '/category/' ) ) . $categories[0]->slug .'">'.$categories[0]->name; ?></a> · <?php echo prefix_estimated_reading_time( get_the_content() ); ?> min read</p>
                            <a href="<?php the_permalink(); ?>">
                                <h3 class="c-card-news__title"><?php echo the_title(); ?></h3>
                            </a>
                        </article>
                    <?php
                        endwhile; wp_reset_query();
                    ?>
                </div>
        </section>
        <?php
            endif;
        ?>
	</div><!-- .content -->

<?php get_footer(); ?>