<div class="accordion">
<?php $published_posts = wp_count_posts()->publish;
$posts_per_page =  esc_attr(get_theme_mod( 'ospersonality_home_blog_posts', '5' ));
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
    'paged'=>$paged,
    'posts_per_page'=>$posts_per_page,
    'tax_query' => array(
        array(
            'taxonomy' => 'post_format',
            'field' => 'slug',
            'terms' => array('post-format-audio','post-format-video','post-format-gallery','post-format-image','post-format-aside'),
            'operator' => 'NOT IN'
        )
    )
);
$ospersonality_query = null;
$ospersonality_query = new WP_Query($args);
    if( $ospersonality_query->have_posts() ) {
    $position = 0;
    while( $ospersonality_query->have_posts() ){ $ospersonality_query->the_post();
        if ( $position % 1==0 ) {
        $image_id = get_post_thumbnail_id();
        $image_url = wp_get_attachment_image_src($image_id,800,800);
        $image_url = $image_url[0];
         $position++; ?>
    <section class="accordion-body row <?php if ($position != 0 and $position%2==0) :
                                                        echo 'second-post';
                                                        else :
                                                        echo 'first-post';
                                                        endif;?>" style="background: url(<?php echo "$image_url"; ?>)">
        <section class="overlay-header">
            <ul>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </section>
        <div class="accord-header">
            <div class="col-lg-10 col-md-10 col-sm-10 col-xs-8">
                <h3 class="cat-title">
                    <span class="accordion-title"><?php the_title();  ?></span>
                </h3>
            </div>
            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-4 date">
                <div class="date-body">
                    <?php $date = the_date('d M Y', '<h2>', '</h5>', $echo = false); echo (str_replace(" ", '</h2><h5>', $date));?>
                </div>
            </div>
        </div>
        <div class="accord-content">
            <div class="cat-body">
                <?php the_excerpt(); ?>
            </div>
            <span class="link-blog">
                <a class="more-button" href="<?php the_permalink(); ?>" rel="bookmark">
                        <?php if (get_theme_mod( 'personnew_more_button' )) :
                                echo esc_attr(get_theme_mod( 'personnew_more_button' ));
                            else :
                                _e('Read Now', 'personnew');
                            endif; ?></a>
            </span>
        </div>
    </section>
        
    <?php } ?>
    <?php } ?>
    <?php  wp_reset_postdata();
    } else {
        get_template_part( 'template-parts/content', 'none' );
} ?>
</div>