<div class="container">
    <section class="background_box_article col-12">
        <header class="title-five">
            <a class="inner-card" href="<?php the_permalink(); ?>">
                <h4 class="Survey-title"><?php echo $settings['title']; ?></h4>
                <?php
                if ('yes' === $settings['show_more']) {
                    echo '<a class="Survey-bt-mor" href="' . $settings['website_link']['url'] . '"' . $target . $nofollow . '>';
                    echo $settings['title_more'];
                    ''; ?>
            </a>
        <?php } ?>
        </a>
        </header>
        <?php
        while ($query->have_posts()) {
            $query->the_post();
        ?>
            <div class="col-12 col-xl-3 col-md-3 col-sm-6 col-xs-6 right">
                <div class="example-2 card-area">
                    <?php
                    if (get_post_thumbnail_id()) {
                        $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), array(300, 300));
                    ?>
                        <div class="wrapper-box" style=" background: url('<?php echo $thumb['0']; ?>') ;background-repeat: no-repeat;background-position: center;background-size: cover;">
                        <?php
                    } else { ?>
                            <div class="wrapper-box" style=" background: url('<?php print(get_template_directory_uri()); ?>/assets/images/thumb.gif" /assets/images/thumb.gif') ;background-repeat: no-repeat;background-position: center;background-size: cover;">
                            <?php } ?>
                            <div class="header">
                                <div class="date daymonthyear">
                                    <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' پیش'; ?>
                                </div>
                            </div>
                            <div class="data extranslateY">
                                <div class="content bac_color">
                                    <span class="author"><?php the_author(); ?></span>
                                    <ul class="menu-content">
                                        <li>
                                            <a href="#" class="fal fa-bookmark"></a>
                                        </li>
                                        <li><a href="#" class="fal fa-heart"><span></span></a></li>
                                        <li><a href="#" class="fal fa-comment"><span><?php comments_number('', '', '%'); ?></span></a></li>
                                    </ul>
                                    <h3 class="title"><a style="color: #212121" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                                    <?php echo '<p class="text text_1">' . get_the_excerpt() . '</p>'; ?>
                                    <p style="margin-bottom:1rem"></p>
                                </div>
                            </div>
                            </div>
                        </div>
                </div>
            <?php
        }
        if (!empty($settings['grid_pagination'])) {
            ?>
                <div class="pagination root" style="width: 100%;">
                    <?php
                    $big = 999999999;
                    $totalpages = $query->max_num_pages;
                    $current = max(1, $paged);
                    $paginate_args = array(
                        'base'      => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
                        'format'    => '?paged=%#%',
                        'current'   => $current,
                        'total'     => $totalpages,
                        'show_all'  => false,
                        'end_size'  => 1,
                        'mid_size'  => 3,
                        'prev_next' => true,
                        'prev_text'          => __('<i class="fa fa-chevron-right" aria-hidden="true"></i>', 'liosa'),
                        'next_text'          => __('<i class="fa fa-chevron-left" aria-hidden="true"></i>', 'liosa'),
                        'screen_reader_text' => __('A', 'liosa')
                    );
                    $pagination = paginate_links($paginate_args);
                    ?>
                    <nav class="pagenumbers">
                        <?php echo $pagination; ?>
                    </nav>
                </div>
            <?php
        }
            ?>
    </section>
</div>