recent.phtml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Copyright © 2016 Ihor Vansach (ihor@magefan.com). 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. <?php
  17. $_postCollection = $block->getPostCollection();
  18. $imageHelper = $this->helper('Magefan\Blog\Helper\Image');
  19. $imageWidth = 500;
  20. $imageHeight = 300;
  21. ?>
  22. <?php if ($_postCollection->count()) { ?>
  23. <div class="post-list-wrapper blog-widget-recent">
  24. <h3 class="title"><?php echo $block->escapeHtml($block->getTitle()) ?></h3>
  25. <amp-carousel
  26. width="500"
  27. height="400"
  28. layout="responsive"
  29. type="slides"
  30. autoplay
  31. delay="5000"
  32. >
  33. <?php foreach ($_postCollection as $_post) { ?>
  34. <?php
  35. $_postUrl = $_post->getPostUrl();
  36. $_postName = $block->escapeHtml($_post->getTitle(), null, true);
  37. ?>
  38. <div class="post-holder post-holder-<?php echo $_post->getId() ?>">
  39. <div class="post-content">
  40. <div class="post-description clearfix">
  41. <?php if ($featuredImage = $_post->getFeaturedImage()) { ?>
  42. <div class="post-ftimg-hld">
  43. <a href="<?php echo $_postUrl ?>" title="<?php echo $_postName ?>">
  44. <amp-img layout="responsive" width="<?php echo $imageWidth ?>" height="<?php echo $imageHeight ?>" src="<?php echo $this->helper('Magefan\Blog\Helper\Image')->init($_post->getFeaturedImg())->resize($imageWidth, $imageHeight) ?>" alt="<?php echo $_postName ?>"></amp-img>
  45. </a>
  46. </div>
  47. <?php } ?>
  48. </div>
  49. </div>
  50. <div class="post-header">
  51. <div class="post-title-holder clearfix">
  52. <div class="post-title">
  53. <a class="post-item-link"
  54. href="<?php echo $_postUrl ?>">
  55. <?php echo $_postName; ?>
  56. </a>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <?php } ?>
  62. </amp-carousel>
  63. </div>
  64. <?php } ?>