1+ <?php
2+ /**
3+ * Copyright © 2016 Ihor Vansach ([email protected] ). All rights reserved. 4+ * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
5+ *
6+ * Glory to Ukraine! Glory to the heroes!
7+ */
8+ ?>
9+ <?php
10+ /**
11+ * Blog recent posts widget
12+ *
13+ * @var $block \Magefan\Blog\Block\Widget\Recent
14+ */
15+ ?>
16+
17+ <?php
18+ $ _postCollection = $ block ->getPostCollection ();
19+ ?>
20+ <?php if ($ _postCollection ->count ()) { ?>
21+ <div class="post-list-wrapper blog-widget-recent blog-widget-recent-masonry">
22+ <h3 class="title"><?php echo $ block ->escapeHtml ($ block ->getTitle ()) ?> </h3>
23+ <ul class="post-list clearfix">
24+ <?php foreach ($ _postCollection as $ _post ) { ?>
25+ <?php
26+ $ _postUrl = $ _post ->getPostUrl ();
27+ $ _postName = $ block ->escapeHtml ($ _post ->getTitle (), null , true );
28+ ?>
29+ <li class="post-holder post-holder-<?php echo $ _post ->getId () ?> ">
30+ <div class="post-header">
31+
32+ <div class="post-title-holder clearfix">
33+ <div class="post-title">
34+ <a class="post-item-link"
35+ href="<?php echo $ _postUrl ?> ">
36+ <?php echo $ _postName ; ?>
37+ </a>
38+ </div>
39+ </div>
40+
41+ <div class="post-info clear">
42+ <div class="item post-posed-date">
43+ <span class="label"><?php echo __ ('Posted: ' ) ?> </span>
44+ <span class="value"><?php echo $ _post ->getPublishDate ('F d, Y ' ) ?> </span>
45+ </div>
46+ <?php if ($ _categoriesCount = $ _post ->getCategoriesCount ()) { ?>
47+ <div class="dash">|</div>
48+ <div class="item post-categories">
49+ <span class="label"><?php echo __ ('Categories: ' ) ?> </span>
50+ <?php $ n = 0 ; foreach ($ _post ->getParentCategories () as $ ct ) { $ n ++; ?>
51+ <a title="<?php echo $ block ->escapeHtml ($ ct ->getTitle ()) ?> " href="<?php echo $ ct ->getCategoryUrl () ?> "><?php echo $ block ->escapeHtml ($ ct ->getTitle ()) ?> </a>
52+ <?php if ($ n != $ _categoriesCount ) { ?> , <?php } ?>
53+ <?php } ?>
54+ </div>
55+ <?php } ?>
56+ </div>
57+ </div>
58+
59+ <div class="post-content">
60+ <div class="post-description clearfix">
61+ <?php if ($ featuredImage = $ _post ->getFeaturedImage ()) { ?>
62+ <div class="post-ftimg-hld">
63+ <a href="<?php echo $ _postUrl ?> " title="<?php echo $ _postName ?> ">
64+ <img src="<?php echo $ featuredImage ?> " alt="<?php echo $ _postName ?> " />
65+ </a>
66+ </div>
67+ <?php } ?>
68+ <?php if ($ content = $ block ->getShorContent ($ _post )) { ?>
69+ <div class="post-text-hld clearfix">
70+ <?php echo $ content ?>
71+ </div>
72+ <?php } ?>
73+ <a class="post-read-more" href="<?php echo $ _postUrl ?> " title="<?php echo $ _postName ?> ">
74+ <?php echo __ ('Read more » ' ) ?>
75+ </a>
76+ </div>
77+ </div>
78+ <div class="post-footer">
79+
80+ </div>
81+ </li>
82+
83+ <?php } ?>
84+ </ul>
85+ </div>
86+ <script>
87+ requirejs( [ 'require', 'jquery', 'Magefan_Blog/js/lib/masonry.pkgd.min' ],
88+ function( require, $, Masonry ) {
89+ require( [ 'jquery-bridget/jquery-bridget' ],
90+ function( jQueryBridget ) {
91+ jQueryBridget( 'masonry', Masonry, $ );
92+ $('.post-list').masonry({
93+ itemSelector: '.post-holder',
94+ percentPosition: true
95+ })
96+ });
97+ });
98+ <?php /* more info http://masonry.desandro.com/extras.html */ ?>
99+ </script>
100+
101+ <?php } ?>
0 commit comments