<?php
/* @var Tangibledesign\MyHome\Widgets\BlogArchive\BlogArchiveWidget $mhCurrentWidget */
global $mhCurrentWidget;
$mhPosts = $mhCurrentWidget->getPosts();
?>
<div class="myhome-blog-archive">
    <div class="myhome-blog-archive__grid">
        <?php
        global $mhCurrentPost;
        foreach ($mhPosts as $mhIndex => $mhCurrentPost) :
            get_template_part('templates/partials/post_card_v5');
        endforeach;
        ?>
    </div>

    <?php
    global $mhPagination;
    $mhPagination = $mhCurrentWidget->getPaginator();
    if ($mhPagination) :
        global $mhPaginationShowInfo;
        $mhPaginationShowInfo = false;
        if (count($mhPagination->getPages())) : ?>
            <div class="myhome-blog-archive__pagination">
                <?php get_template_part('templates/partials/pagination'); ?>
            </div>
        <?php
        endif;

        $mhPagination = $mhCurrentWidget->getPaginator(3);
        if (count($mhPagination->getPages())) : ?>
            <div class="myhome-blog-archive__mobile-pagination">
                <?php get_template_part('templates/partials/pagination'); ?>
            </div>
        <?php endif; ?>
        <?php unset($mhPaginationShowInfo); ?>
    <?php endif; ?>
</div>
