<?php
$published_posts = wp_count_posts()->publish;
$posts_per_page = -1;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
    'post_type' => 'lp_course',
    'post_status' => 'publish',
    'paged'=>$paged,
    'posts_per_page'=>$posts_per_page
);
$ospersonality_courses = null;
$ospersonality_courses = new WP_Query($args);
    if( $ospersonality_courses->have_posts() ) {
    $position = 0;
    while( $ospersonality_courses->have_posts() ){ $ospersonality_courses->the_post();
        if ( $position % 4==0 ) { ?>
        <div class="row">
        <?php } ?>
            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 course-item">
            <?php get_template_part( 'template-parts/content', 'courses' ); ?>
            </div>
        <?php $position++;
        if ($position != 0 and $position % 4==0) { ?>
        </div>
        <?php } ?>
    <?php } ?>
    <?php  wp_reset_postdata();
    } else {
        get_template_part( 'template-parts/content', 'none' );
} ?>
