<?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 Law Firm
 */

get_header(); ?>

<div id="content" >
    <?php
        $classic_law_firm_hidepageboxes = get_theme_mod('classic_law_firm_slider', true);
        $classic_law_firm_catData = get_theme_mod('classic_law_firm_slider_cat');
        if ($classic_law_firm_hidepageboxes && $classic_law_firm_catData) { ?>
        <section id="slider-cat">
            <div class="slideimg">
                <div class="owl-carousel m-0">
                    <?php
                        $classic_law_firm_page_query = new WP_Query(
                            array(
                                'category_name' => esc_attr($classic_law_firm_catData),
                                'posts_per_page' => -1,
                            )
                        );
                        while ($classic_law_firm_page_query->have_posts()) : $classic_law_firm_page_query->the_post(); ?>
                            <div class="imagebox position-relative">
                                <?php if(has_post_thumbnail()){
                                    the_post_thumbnail('full', array('class' => 'post-image'));
                                } else { ?>
                                    <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/slider.png" alt="<?php echo esc_attr( 'slider', 'classic-law-firm'); ?>" class="post-image"/>
                                <?php } ?>
                                <div class="slider-overlay"></div>
                                <div class="container">
                                    <div class="row">
                                        <div class="col-lg-7 col-md-6 col-12 align-self-center mb-md-0 mb-2 slider-post-content position-absolute">
                                            <div class="text-content wow zoomInUp" data-wow-duration="2s">
                                                <?php if (get_theme_mod('classic_law_firm_slider_small_title') != "") { ?>
                                                    <p class="small-title mb-3 text-capitalize"><?php echo esc_html(get_theme_mod('classic_law_firm_slider_small_title', 'classic-law-firm')); ?></p>
                                                <?php } ?>
                                                <h1 class="slider-title text-capitalize"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                                                <?php
                                                    $classic_law_firm_trimexcerpt  = get_the_excerpt();
                                                    $classic_law_firm_shortexcerpt = wp_trim_words($classic_law_firm_trimexcerpt, $classic_law_firm_num_words = 25);
                                                    echo '<p class="slider-content mb-3">' . esc_html($classic_law_firm_shortexcerpt) . '</p>';
                                                ?>
                                                <div class="sliderbtn pt-3">
                                                    <?php 
                                                        $classic_law_firm_button_text = get_theme_mod('classic_law_firm_button_text', 'Our Best Services');
                                                        $classic_law_firm_button_link_slider = get_theme_mod('classic_law_firm_button_link_slider', ''); 
                                                        if (empty($classic_law_firm_button_link_slider)) {
                                                            $classic_law_firm_button_link_slider = esc_url(get_permalink());
                                                        }
                                                        if ($classic_law_firm_button_text || !empty($classic_law_firm_button_link_slider)) { ?>
                                                        <?php if(get_theme_mod('classic_law_firm_button_text', 'Our Best Services') != ''){ ?>
                                                            <a href="<?php echo esc_url($classic_law_firm_button_link_slider); ?>" class="post-btn text-capitalize">
                                                                <?php echo esc_html($classic_law_firm_button_text); ?>
                                                                <span class="screen-reader-text"><?php echo esc_html($classic_law_firm_button_text); ?></span>
                                                            </a>
                                                        <?php } ?>
                                                    <?php } ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <?php endwhile;
                        wp_reset_postdata();
                    ?>
                </div>
            </div>
        </section>
    <?php } ?>

    <!-- Our Lawyers Section -->
    <?php
        $classic_law_firm_hide_lawyer_section = get_theme_mod('classic_law_firm_disabled_lawyer_section', true);
        if ($classic_law_firm_hide_lawyer_section){ ?>
        <section id="lawyer-section" class="py-5">
            <div class="container">
                <div class="blog-bx mb-4 text-center">
                    <?php if (get_theme_mod('classic_law_firm_lawyer_text') != "") { ?>
                        <p class="lawyer-text mb-1 text-capitalize"><?php echo esc_html(get_theme_mod('classic_law_firm_lawyer_text', 'classic-law-firm')); ?></p>
                    <?php } ?>
                    <?php if (get_theme_mod('classic_law_firm_lawyer_title') != "") { ?>
                        <h2 class="lawyer-title pb-3 text-capitalize"><?php echo esc_html(get_theme_mod('classic_law_firm_lawyer_title', 'classic-law-firm')); ?></h2>
                    <?php } ?>
                </div> 
                <div class="lawyer-content wow zoomIn delay-3000" data-wow-duration="2s">
                    <div class="row">
                        <?php 
                            for ($classic_law_firm_i = 1; $classic_law_firm_i <= 3; $classic_law_firm_i++) {?>
                            <div class="col-xl-4 col-lg-4 col-md-4 col-12 mt-5">
                                <?php if (get_theme_mod('classic_law_firm_lawyer_img'.$classic_law_firm_i) != "") { ?>
                                    <div class="lawyer-img position-relative mb-5">
                                        <img src="<?php echo esc_url(get_theme_mod('classic_law_firm_lawyer_img'.$classic_law_firm_i)); ?>" alt="<?php echo esc_attr( 'lawyer-img', 'classic-law-firm'); ?>"/>
                                        <div class="lawyer-color"></div>
                                    </div>
                                <?php } ?>
                                <?php if (get_theme_mod('classic_law_firm_lawyer_name'.$classic_law_firm_i) != "") { ?>
                                    <a target="_blank" href="<?php echo esc_url(get_theme_mod('classic_law_firm_lawyer_name_url'.$classic_law_firm_i)); ?>"><h3 class="lawyer-name mb-1 text-capitalize text-center"><?php echo esc_html(get_theme_mod('classic_law_firm_lawyer_name'.$classic_law_firm_i, 'classic-law-firm')); ?></h3></a> 
                                <?php } ?>
                                <?php if (get_theme_mod('classic_law_firm_lawyer_category'.$classic_law_firm_i) != "") { ?>
                                    <p class="lawyer-cat mb-1 text-capitalize text-center"><?php echo esc_html(get_theme_mod('classic_law_firm_lawyer_category'.$classic_law_firm_i, 'classic-law-firm')); ?></p>
                                <?php } ?>
                            </div>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </section>
    <?php } ?>
</div>
<?php get_footer(); ?>
