<?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\Frontend $block */
?>

<div class="mp-blog-rss">
    <a href="<?= $block->getRssUrl('post/rss') ?>" class="bb-rss-icon">
        <img src="<?= $this->getViewFileUrl('Mageplaza_Blog::media/images/rss.png') ?>" width="16px">
    </a>
</div>
<div class="container">
    <div class="row">
        <div class="col-sm-10">
            <div class="row">
                


                
                
                
                
                
    <?php $postCollection = $block->getPostCollection(); ?>
    <?php $postCollection->addAttributeToSelect('*')
    //->addAttributeToFilter('post_id', array('in' => $postid))
           ->getSelect()->orderRand(); ?>
    <?php if ($postCollection && $postCollection->getSize()) : ?>
                     <?php $i = 1 ?>
            <?php /** @var \Mageplaza\Blog\Model\Post $post */
            foreach ($postCollection as $post) : ?>
                    <div class="col-sm-4">
                    <div class="blogbox">
                        <div class="bltxtname">
                        <h2><a href="<?= $post->getUrl() ?>"><?= $post->getName(); ?></a></h2></div>
                        <?php if ($post->getImage()) : ?>
                        
                        <div class="blpic">
                            <a href="<?= $post->getUrl() ?>"><img class="img-responsive" src="<?= $block->resizeImage($post->getImage(), '400x'); ?>" alt="<?= $block->escapeHtml($post->getName()); ?>">
                                </a>
                        </div>
                        <?php endif; ?>
                        <div class="bltxt">
                            <p><?= $block->maxShortDescription(substr($post->getShortDescription(),0,80).'..'); ?></p>
                        </div>
                        
                        
                    </div>
                    </div>
                    
                    <?php if ($i++ % 3 == 0) : ?>
                    <div class="mp-clear"></div>
                <?php endif; ?>
            <?php endforeach; ?>
            <div class="mp-clear"></div>
    <?= $block->getPagerHtml() ?>
    <?php else : ?>
        <?= __('There are no posts at this moment'); ?>
    <?php endif; ?>
    <?= $this->getChildHtml('additional'); ?>
</div>
</div>
</div>
</div>
<script>
    require(['jquery'], function ($) {
        $('.limiter').css('float', 'right');
    });
</script>

