Nessuna descrizione

content-grid.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Template part for displaying posts
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  6. *
  7. * @package XShop
  8. */
  9. $xshop_categories = get_the_category();
  10. if($xshop_categories){
  11. $xshop_category = $xshop_categories[mt_rand(0,count( $xshop_categories)-1)];
  12. }else{
  13. $xshop_category = '';
  14. }
  15. ?>
  16. <div class="col-lg-6 grid-item">
  17. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  18. <div class="xpost-item shadow pb-3 mb-5">
  19. <?php xshop_post_thumbnail(); ?>
  20. <div class="xpost-text xpost-grid-text p-3">
  21. <div class="grid-head">
  22. <span class="ghead-meta">
  23. <?php if ( 'post' === get_post_type() && !empty($xshop_category) ) : ?>
  24. <a href="<?php echo esc_url(get_category_link($xshop_category)); ?>"><?php echo esc_html($xshop_category->name.' / '); ?></a>
  25. <?php endif; ?>
  26. <?php echo esc_html( get_the_date()); ?>
  27. </span>
  28. <?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
  29. </div>
  30. <a class="xshop-readmore" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Read More ','xshop'); ?> <i class="fas fa-long-arrow-alt-right"></i></a>
  31. </div>
  32. </div>
  33. </article><!-- #post-<?php the_ID(); ?> -->
  34. </div>