<?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\Model\ResourceModel\Post\Collection $posts */
/** @var \Mageplaza\Blog\Block\Post\RelatedPost $block */
$posts = $block->getRelatedPostList();
if ($posts) : ?>

    <?php if ($block->getRelatedMode() && $block->isEnabledBlog()) :?>
        
            <?php foreach ($posts as $post) : ?>
                
                <div class="col-sm-3">
                        <div class="blgbox">
                            <a href="<?= $post->getUrl() ?>">
                                    <img class="img-responsive" src="<?= $block->resizeImage($post->getImage(), '400x'); ?>"
                                     alt="<?= $block->escapeHtml($post->getName()); ?>">
                                </a>
                        <h2><a href="<?= $post->getUrl() ?>" title="<?= $post->getName(); ?>"><?= $post->getName(); ?></a></h2>
                        <p><?= $post->getShortDescription(); ?></p>
                            
                        </div>
                      </div>
                
                
            <?php endforeach; ?>
        
       <?php else :?>
        <ul>
            <?php foreach ($posts as $post) : ?>
                <li><a href="<?= $post->getUrl() ?>"><?= $post->getName(); ?></a></li>
            <?php endforeach; ?>
        </ul>
    <?php endif;?>
<?php endif; ?>
