<?php
/**
 * Choose Section
 * 
 * @package architectonic_structure
 */
$architectonic_structure_classes      = get_theme_mod( 'architectonic_structure_classes_setting', false );
$architectonic_structure_service_title = get_theme_mod( 'architectonic_structure_service_title' );
$architectonic_structure_service_text  = get_theme_mod( 'architectonic_structure_service_text' );
?>
<?php if ( $architectonic_structure_classes ) : ?>
    <div class="services-section">     
        <div class="side-border">
            <div class="side-content">
                <?php if ( $architectonic_structure_service_title ) : ?>
                    <h3><?php echo esc_html( $architectonic_structure_service_title ); ?></h3>
                <?php endif; ?>
                <?php if ( $architectonic_structure_service_text ) : ?>
                    <p class="title-text"><?php echo esc_html( $architectonic_structure_service_text ); ?></p>
                <?php endif; ?>
            </div>
        </div>
        <div class="container">
            <div class="owl-carousel">
                <?php 
                    $architectonic_structure_catergory_name = get_theme_mod( 'architectonic_structure_blog_args_' );
                    $architectonic_structure_args = array(
                        'post_type'           => 'post',
                        'category_name'       => $architectonic_structure_catergory_name,
                        'orderby'             => 'post__in',
                        'ignore_sticky_posts' => true,
                    );

                    $architectonic_structure_loop = new WP_Query( $architectonic_structure_args );
                    if ( $architectonic_structure_loop->have_posts() ) :
                        $architectonic_structure_i = 1;
                        while ( $architectonic_structure_loop->have_posts() ) : $architectonic_structure_loop->the_post(); ?>
                            <div class="box wow zoomIn" data-wow-duration="2s">
                                <div class="image-blog">
                                    <?php 
                                        if ( has_post_thumbnail() ) {
                                            the_post_thumbnail( 'medium' );
                                        } else {
                                    ?>
                                    <img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/images/default.png' ); ?>" alt="<?php the_title_attribute(); ?>">
                                    <?php } ?>
                                </div>                               
                                <div class="box-content">
                                    <?php if ( get_theme_mod( 'architectonic_structure_category_icon' . $architectonic_structure_i ) != '' ) : ?>
                                        <span class="post-icon">
                                            <i class="<?php echo esc_attr( get_theme_mod( 'architectonic_structure_category_icon' . $architectonic_structure_i ) ); ?>"></i>
                                        </span>
                                    <?php endif; ?>
                                    <h4 class="title">
                                        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                                    </h4>
                                    <p class="mb-0 para"><?php echo wp_trim_words( get_the_content(), 15 ); ?></p>
                                    <p class="sign-in-area">
                                        <a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>">
                                            <i class="fas fa-arrow-right-long"></i>
                                        </a>
                                    </p>
                                </div>
                            </div>
                        <?php 
                        $architectonic_structure_i++;
                        endwhile;
                    endif;
                ?>
            </div>
        </div>
    </div>
<?php endif; ?>

