Skip to content

Instantly share code, notes, and snippets.

@dsebao
Last active September 17, 2018 17:59
Show Gist options
  • Save dsebao/5b94e4fc43bc26b8945284863a4e713a to your computer and use it in GitHub Desktop.
Save dsebao/5b94e4fc43bc26b8945284863a4e713a to your computer and use it in GitHub Desktop.
<h5>Seguí leyendo</h5>
<?php
$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 3, 'post__not_in' => array($post->ID) ) );
if( $related ) foreach( $related as $post ) {
setup_postdata($post);?>
<article>
<div class="row">
<div class="col-3">
<?php if(my_image($post->ID, 'thumbnail')){?>
<a href="<?php the_permalink();?>" class="image-link">
<img src="<?php echo my_image($post->ID, 'thumbnail');?>" alt="<?php the_title();?>"></a>
<?php }?>
</div>
<div class="col-9">
<h4><a href="<?php the_permalink();?>" title="<?php the_title();?>"><?php the_title();?>”</a></h4>
<time datetime="<?php echo get_the_date('Y-m-d\TH:i:sP'); ?>" itemprop="datePublished"><?php echo get_the_date(); ?> </time></span>
</div>
</div>
</article>
<?php }
wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment