<?php 
/**
 * Template part for displaying Featured Classes Section
 *
 * @package Content Marketing
 */

$content_marketing_classes = get_theme_mod( 'content_marketing_classes_setting',false );
$content_marketing_service_title = get_theme_mod( 'content_marketing_service_title' );
$content_marketing_service_text = get_theme_mod( 'content_marketing_service_text' );

?>
<?php if ( $content_marketing_classes ){?>
<div class="our-classes">
    <div class="container">
        <div class="service">
            <div class="side-border">
                <?php if ( $content_marketing_service_text ){?>
                    <p class="title-text"><?php echo esc_html( $content_marketing_service_text );?></p>
                <?php } ?> 
                <?php if ( $content_marketing_service_title ){?>
                    <h3 class="mb-5"><?php echo esc_html( $content_marketing_service_title );?></h3>
                <?php } ?>                       
            </div>
            <div class="owl-carousel">
                <?php 
                    $content_marketing_catergory_name = get_theme_mod('content_marketing_blog_args_');
                    $args = array(
                        'post_type'           => 'post',
                        'category_name'       => $content_marketing_catergory_name,
                        'orderby'             => 'post__in',
                        'ignore_sticky_posts' => true,
                    );
                    ?>
                    <?php
                    $loop = new WP_Query($args);
                    if ( $loop->have_posts() ) :
                        $i=1;
                        while ($loop->have_posts()) : $loop->the_post(); ?>
                                <div class="upper-box">
                                    <div class="box wow zoomInUp delay-1000" data-wow-duration="2s">
                                        <?php
                                            if ( has_post_thumbnail() ) : ?>
                                            <div class="image-blog">
                                              <?php the_post_thumbnail();?>
                                            </div>
                                            <?php else:
                                              ?>
                                              <div class="image-blog">
                                                <img src="<?php echo get_stylesheet_directory_uri() . '/images/default-header.png'; ?>">
                                              </div>
                                              <?php
                                            endif;
                                          ?>
                                        <div class="box-content">
                                            <h4 class="title mb-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                            <p class="mb-5"><?php echo wp_trim_words( get_the_content(), 15 ); ?></p>
                                            <span class="service-dot"></span>
                                        </div>
                                    </div>
                                </div>
                        <?php  $i++; endwhile;
                    endif;
                ?>
            </div>
        </div>
    </div>
</div>
<?php } ?>