<?php
/**
 * The Template Name: Home Page
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package Classic Artificial Intelligence
 */

get_header(); ?>

<div id="content" >

  <?php
  $classic_artificial_intelligence_hidepageboxes = get_theme_mod('classic_artificial_intelligence_slider', false);
  $classic_artificial_intelligence_catData = get_theme_mod('classic_artificial_intelligence_slider_cat');
  $classic_artificial_intelligence_slider_banner1_url = esc_url(get_theme_mod('classic_artificial_intelligence_slider_banner1_url'));

  if ($classic_artificial_intelligence_hidepageboxes && $classic_artificial_intelligence_catData) { ?>
    <section id="slider-cat" style="background-image: url('<?php echo !empty($classic_artificial_intelligence_slider_banner1_url) ? esc_url($classic_artificial_intelligence_slider_banner1_url) : esc_url(get_template_directory_uri() . '/images/slider-bg.png'); ?>');">
        <div class="slideimg">
            <div class="container sliderbox">
                <div class="owl-carousel m-0 owl-theme">
                    <?php
                    $classic_artificial_intelligence_page_query = new WP_Query(
                        array(
                            'category_name' => esc_attr($classic_artificial_intelligence_catData),
                            'posts_per_page' => -1,
                        )
                    );

                    while ($classic_artificial_intelligence_page_query->have_posts()) : $classic_artificial_intelligence_page_query->the_post(); ?>
                        <div class="row m-0">
                            <div class="col-lg-6 col-md-6 col-12 align-self-center mb-md-0 mb-2">
                                <div class="text-content">
                                    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                                    <?php
                                    $classic_artificial_intelligence_trimexcerpt = get_the_excerpt();
                                    $classic_artificial_intelligence_shortexcerpt = wp_trim_words($classic_artificial_intelligence_trimexcerpt, 23);
                                    echo '<p class="slider-content">' . esc_html($classic_artificial_intelligence_shortexcerpt) . '</p>';
                                    ?>
                                    <div class="sliderbtn mt-3">
                                        <?php 
                                        $classic_artificial_intelligence_button_text = get_theme_mod('classic_artificial_intelligence_button_text', 'Get Started');
                                        $classic_artificial_intelligence_button_link_slider = get_theme_mod('classic_artificial_intelligence_button_link_slider', get_permalink()); 
                                        if ($classic_artificial_intelligence_button_text || !empty($classic_artificial_intelligence_button_link_slider)) { ?>
                                            <div class="slide-btn mt-4">
                                                <a href="<?php echo esc_url($classic_artificial_intelligence_button_link_slider); ?>" class="button redmor">
                                                    <?php echo esc_html($classic_artificial_intelligence_button_text); ?>
                                                    <span class="screen-reader-text"><?php echo esc_html($classic_artificial_intelligence_button_text); ?></span>
                                                </a>
                                            </div>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6 col-md-6 align-self-center slider-img-col">
                                <div class="row">
                                    <div class="col-lg-3 col-md-3 col-3 align-self-center px-0 slide-banner first">
                                        <?php if (get_theme_mod('classic_artificial_intelligence_slider_banner1') != '') { ?>
                                            <img src="<?php echo esc_url(get_theme_mod('classic_artificial_intelligence_slider_banner1')); ?>" alt="<?php echo esc_attr( 'banner', 'classic-artificial-intelligence'); ?>" />
                                        <?php } ?>
                                    </div>
                                    <div class="col-lg-6 col-md-6 col-6 align-self-center px-0">
                                        <div class="imagebox">
                                            <?php if (has_post_thumbnail()) {
                                                the_post_thumbnail('full');
                                            } else { ?>
                                                <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/slider.png" alt="<?php echo esc_attr( 'slider', 'classic-artificial-intelligence'); ?>"/>
                                            <?php } ?>
                                        </div>
                                    </div>
                                    <div class="col-lg-3 col-md-3 col-3 align-self-center px-0 slide-banner second">
                                        <?php if (get_theme_mod('classic_artificial_intelligence_slider_banner2') != '') { ?>
                                            <img src="<?php echo esc_url(get_theme_mod('classic_artificial_intelligence_slider_banner2')); ?>" alt="<?php echo esc_attr( 'banner', 'classic-artificial-intelligence'); ?>" />
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endwhile; wp_reset_postdata(); ?>
                </div>
            </div>
        </div>
    </section>
<?php } ?>

  <?php
$classic_artificial_intelligence_hidepageboxes = get_theme_mod('classic_artificial_intelligence_disabled_pgboxes', false);
$classic_artificial_intelligence_about_pageboxes = get_theme_mod('classic_artificial_intelligence_about_pageboxes', false);

if ($classic_artificial_intelligence_hidepageboxes && $classic_artificial_intelligence_about_pageboxes) { ?>
    <div id="about_section" class="my-5">
        <?php
        $classic_artificial_intelligence_about_page_id = esc_attr(get_theme_mod('classic_artificial_intelligence_about_pageboxes', false));
        if ($classic_artificial_intelligence_about_page_id) {
            $classic_artificial_intelligence_querymed = new WP_Query(array(
                'page_id' => $classic_artificial_intelligence_about_page_id
            ));
            
            while ($classic_artificial_intelligence_querymed->have_posts()) : $classic_artificial_intelligence_querymed->the_post(); ?>
                <div class="row m-0">
                    <div class="col-lg-6 col-md-6 align-self-center about-featured mb-md-0 mb-5 px-0">
                        <?php if (has_post_thumbnail()) : ?>
                            <div class="thumbbx">
                                <?php the_post_thumbnail('full'); ?>
                            </div>
                        <?php else : ?>
                            <div class="post-color"></div>
                        <?php endif; ?>
                    </div>
                    <div class="col-lg-6 col-md-6 align-self-center px-md-5 px-3">
                        <div class="container">
                            <div class="text-inner-box abt-content">
                                <?php if (get_theme_mod('classic_artificial_intelligence_about_title') != '') { ?>
                                    <p class="abt-title mb-2">
                                        <?php echo esc_html(get_theme_mod('classic_artificial_intelligence_about_title')); ?>
                                    </p>
                                <?php } ?>
                                <h2 class="mb-lg-3 mb-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                                <p class="main-para mb-3"><?php echo esc_html(wp_trim_words(get_the_content(), 55, '')); ?></p>
                                <div class="row">
                                    <?php 
                                    for ($classic_artificial_intelligence_i = 1; $classic_artificial_intelligence_i <= 2; $classic_artificial_intelligence_i++) { 
                                        $classic_artificial_intelligence_sentence = get_theme_mod('classic_artificial_intelligence_about_sentence' . $classic_artificial_intelligence_i);
                                        if ($classic_artificial_intelligence_sentence != '') { ?>
                                            <div class="col-lg-6 col-md-6">
                                                <p class="abt-sentence my-3 text-capitalize"><i class="fas fa-check pe-3"></i><?php echo esc_html($classic_artificial_intelligence_sentence); ?></p>
                                            </div>
                                        <?php } 
                                    } ?>
                                </div>
                                <div class="abt-btn mt-4">
                                    <a class="text-decoration-none" href="<?php the_permalink(); ?>"><?php esc_html_e('Know More', 'classic-artificial-intelligence'); ?></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endwhile;
            wp_reset_postdata();
        }
        ?>
    </div>
<?php } ?>



</div>
<?php get_footer(); ?>
