Hi I'm a bit new with adding custom functions in my code but I'm building a blog and in the every post page has a button where it says previous or next article. I wanted to use that pre existing function but display a block with the featured image for the each previous/next post.
I'm using Radcliffe theme and the arrows are in the bottom of the page:
This is the part of the code I wanna add the "block"
Thank you
<div class="post-nav">
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<p class="post-nav-next">
<a title="<?php _e('Next post:', 'radcliffe'); echo ' ' . get_the_title($next_post); ?>" href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo get_the_title($next_post); ?> </a>
</p>
<?php endif; ?>
<?php
$prev_post = get_previous_post();
if (!empty( $prev_post )): ?>
<p class="post-nav-prev">
<a title="<?php _e('Previous post:', 'radcliffe'); echo ' ' . get_the_title($prev_post); ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>"><?php echo get_the_title($prev_post); ?> </a>
</p>
<?php endif; ?>
Aucun commentaire:
Enregistrer un commentaire