<?php
/**
 * Mageplaza
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Mageplaza.com license that is
 * available through the world-wide-web at this URL:
 * https://www.mageplaza.com/LICENSE.txt
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category    Mageplaza
 * @package     Mageplaza_Blog
 * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
 * @license     https://www.mageplaza.com/LICENSE.txt
 */

/** @var \Mageplaza\Blog\Block\Widget\Posts $block */

$posts = $block->getCollection();
?>
<div class="blog-widget-title"><a></a></div>
<div class="post-list-container mpcss" id="mpblog-list-container">
    <div class="widget-title">
        <a href="<?= $block->getBlogUrl(''); ?>"><?= $block->getTitle(); ?></a>
    </div>
    <div class="row">
        <?php foreach ($posts as $post) : ?>
            <div class="post-list-item" style="margin-left: 5px">
                <div class="post-item-wraper">
                    <?php if ($post->getImage()) : ?>
                        <div class="post-image">
                            <a href="<?= $post->getUrl() ?>">
                                <img class="img-responsive" style="height: 220px"
                                     src="<?= $block->resizeImage($post->getImage(), '400x'); ?>"
                                     alt="<?= $block->escapeHtml($post->getName()); ?>"/>
                            </a>
                        </div>
                    <?php endif; ?>
                    <div class="post-info-wraper">
                        <h2 class="mp-post-title" style="font-size: 22px">
                            <a class="post-link-title" title="<?= $post->getName(); ?>"
                               href="<?= $post->getUrl() ?>">
                                <?= $post->getName(); ?>
                            </a>
                        </h2>
                        <div class="mp-post-info">
                            <?= $block->getPostInfo($post) ?>
                        </div>
                        <div class="post-short-description">
                            <p><?= $post->getShortDescription(); ?></p>
                        </div>
                        <div class="mp-clearfix"></div>
                        <div class="mp-post-meta-info mp-alignright">
                            <div class="actions">
                                <a class="mp-read-more" href="<?= $post->getUrl(); ?>"
                                   title="<?= __('Read More'); ?>"><?= __('Read more'); ?></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
</div>
