<?php 
/**
 * Template part for displaying Featured Classes Section
 *
 * @package Prime Cyber Security
 */

$prime_cyber_security_classes = get_theme_mod( 'prime_cyber_security_classes_setting',false );
$prime_cyber_security_service_title = get_theme_mod( 'prime_cyber_security_service_title' );
$prime_cyber_security_service_text = get_theme_mod( 'prime_cyber_security_service_text' );

?>
<?php if ( $prime_cyber_security_classes ){?>
<div class="our-classes">
    <div class="side-border">
        <?php if ( $prime_cyber_security_service_text ){?>
            <p class="title-text"><?php echo esc_html( $prime_cyber_security_service_text );?></p>
        <?php } ?> 
        <?php if ( $prime_cyber_security_service_title ){?>
            <h3 class="mb-5"><?php echo esc_html( $prime_cyber_security_service_title );?></h3>
        <?php } ?>                       
    </div>
    <div class="container">
        <div class="row">
                <?php 
                $prime_cyber_security_catergory_name = get_theme_mod('prime_cyber_security_blog_args_');
                $args = array(
                    'post_type'           => 'post',
                    'category_name'       => $prime_cyber_security_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="col-lg-3 col-md-6 align-self-center px-0">
                            <div class="box">
                                <?php if( get_theme_mod( 'prime_cyber_security_category_icon'.$i ) != '' ) { ?>
                                    <span><i class="<?php echo esc_attr(get_theme_mod('prime_cyber_security_category_icon'.$i)); ?>"></i></span>
                                <?php } ?>
                                <div class="box-content">
                                    <h4 class="title mb-2 mt-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                    <p class="mb-0"><?php echo wp_trim_words( get_the_content(), 8 ); ?></p>
                                </div>
                            </div>
                        </div>
                    <?php  $i++; endwhile;
                endif;?>            
        </div>
    </div>
</div>
<?php } ?>