<?php 
/**
 * Template part for displaying Featured Classes Section
 *
 * @package Business Solutions
 */

$business_solutions_classes      = get_theme_mod( 'business_solutions_classes_setting', false );
$business_solutions_service_title = get_theme_mod( 'business_solutions_service_title' );
$business_solutions_service_text  = get_theme_mod( 'business_solutions_service_text' );
?>

<?php if ( $business_solutions_classes ) : ?>
    <div class="our-classes">
        <div class="container">
            <div class="side-border">
                <?php if ( $business_solutions_service_title ) : ?>
                    <h3 class="mb-3"><?php echo esc_html( $business_solutions_service_title ); ?></h3>
                <?php endif; ?>

                <?php if ( $business_solutions_service_text ) : ?>
                    <p class="title-text"><?php echo esc_html( $business_solutions_service_text ); ?></p>
                <?php endif; ?>
            </div>

            <div class="owl-carousel">
                <?php 
                $business_solutions_catergory_name = get_theme_mod( 'business_solutions_blog_args_' );
                $args = array(
                    'post_type'           => 'post',
                    'category_name'       => $business_solutions_catergory_name,
                    'orderby'             => 'post__in',
                    'ignore_sticky_posts' => true,
                );

                $loop = new WP_Query( $args );
                if ( $loop->have_posts() ) :
                    $i = 1;
                    while ( $loop->have_posts() ) : $loop->the_post(); ?>
                        <div class="box wow zoomIn delay-1000" data-wow-duration="2s">
                            <div class="box-content">
                                <?php if ( get_theme_mod( 'business_solutions_category_icon' . $i ) != '' ) : ?>
                                    <span><i class="<?php echo esc_attr( get_theme_mod( 'business_solutions_category_icon' . $i ) ); ?>"></i></span>
                                <?php endif; ?>
                                <h4 class="title mb-2 mt-3">
                                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                                </h4>
                                <p class="mb-0"><?php echo wp_trim_words( get_the_content(), 15 ); ?></p>
                                <p class="sign-in-area mt-3">
                                    <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><i class="fas fa-chevron-right"></i><?php esc_html_e('Read More', 'business-solutions'); ?>
                                    </a>
                                </p>
                            </div>
                        </div>
                    <?php 
                    $i++;
                    endwhile;
                endif;
                ?>
            </div>
        </div>
    </div>
<?php endif; ?>