<?php
add_filter( 'previous_post_link', 'mta_custom_related_posts', 10, 5 );
add_filter( 'next_post_link', 'mta_custom_related_posts', 10, 5 );
function mta_custom_related_posts ( $output, $format, $link, $post, $adjacent ) {
if ( !is_single() || !$post ) { return $output; }
$img = genesis_get_image( array(
'post_id' => $post->ID,
'format' => 'html',
'size' => genesis_get_option( 'image_size' ),
'context' => 'archive',
'attr' => genesis_parse_attr( 'entry-image', array(
'alt' => $post->post_title,
) ),
) );
//echo '<pre>'; var_dump( $post ); echo '</pre>';
ob_start(); ?>
<div class='mta-custom-rel'>
<?php if ( $img ) : ?>
<a class='mta-custom-rel-thumb' href='<?= get_permalink( $post ) ?>' rel='<?= $adjacent ?>'><?= $img ?></a>
<?php endif; ?>
<div class='mta-custom-rel-content'>
<h3><a href='<?= get_permalink( $post ) ?>'><?= $post->post_title ?></a></h3>
<span class='post-date'><?php $date = new DateTime( $post->post_date ); echo $date->format('F j, Y'); ?></span>
</div>
</div>
<?php $output = ob_get_clean();
return $output;
}