<?php
/**
 * wp-it-courses WordPress Theme, ordasvit.com
 * wp-it-courses is distributed under the terms of the GNU GPL
 * Copyright: 2023 OrdaSvit, Andrey Kvasnevskiy, ordasvit.com
 */
?>
<?php wp_it_courses_show_position_preview("main_content"); ?>

<div class="row">
    <?php
    //echo $countcat->count; 
    
    //    print_r($countcat->count);
    //    $posts_all = $countcat->count;
    
    //andrew add comment 2023_09_18
    // //$posts_per_page_cat = 3 ;
    // $posts_per_page_cat = $wp_query->query_vars['posts_per_page'];
    // $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    // $catid = (get_query_var('cat')) ? get_query_var('cat') : 1;
    
    // query_posts(
    //   array(
    //     'paged' => $paged,
    //     'posts_per_page' => $posts_per_page_cat,
    //     'cat' => $catid
    //   )
    // );
    //andrew add comment 2023_09_18
    
    if (have_posts()) {
        while (have_posts()) {
            the_post(); ?>
            <div class=" col-lg-4 col-md-6 col-sm-12 col-xs-12 wrapper-short-post">
                <div class="wrapper-inner-short-post">
                    <div class="wrapper-short-post-img">
                        <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(array(400, 400)); ?></a>
                    </div>
                    <div class="wrapper-short-post-info">
                        <h3 class="wrapper-short-post-title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
                        <div class="wrapper-short-post-date"><?php echo get_the_date();?></div>
                        <p class="wrapper-short-post-desc">
                            <?php the_excerpt(); ?>
                        </p>
                        <div class="wrapper-short-post-details">
                            <a href="<?php the_permalink() ?>">Detalis</a>
                        </div>
                    </div>
                </div>
            </div>
        <?php }

        ?>
        <div class="wrapper-pagination">
            <?php
            //os_pagenavi_category($posts_all, $posts_per_page_cat); andrew add comment 2023_09_18
            //os_pagenavi_blog("", $posts_per_page_cat) ;
            wp_it_courses_the_posts_navigation();
            ?>
        </div>
        <?php
    } else { ?>
        <div class=" col-lg-12 col-md-12 col-sm-12 col-xs-12 wrapper-not-found">
            <h2>
                <?php _e('NOT FOUND', 'wp-it-courses'); ?>
            </h2>
        </div>
        <?php
    }
    //wp_reset_query(); andrew add comment 2023_09_18
    ?>

</div>