Hello, I’ve found the solution to add Next & Previous buttons and it’s working great:
add_action ('the_content', 'add_next_post_item_link' );
function add_next_post_item_link ( $content ) {
if ( is_singular('post') ) {
$next_name = "Next Post <i class=\"x-icon-chevron-right\"></i>";
$prev_name = "<i class=\"x-icon-chevron-left\"></i> Previous Post";
$next_link = get_next_post() ? '<a style="float: left;" href="' . get_permalink( get_next_post()->ID ) . '">' . $prev_name . '</a>' : '';
$prev_link = get_previous_post() ? '<a style="float: right;" href="' . get_permalink( get_previous_post()->ID ) . '">' . $next_name . '</a>' : '';
$posts = '<div class="wp-post-navigation-next">'.$next_link.$prev_link.'</div>';
return $content . $posts;
} else {
return $content;
}
}
I have zero PHP knowledge so I can’t even do this:
Below the next/previous button, I would like to have a thumbnail based on the posts’ featured image and below that thumbnail I’d like the name of the post. I’d like to style them with CSS so it’ll be great if they can have classes as well.
I’m thinking that maybe the link tag should wrap 3 divs:
<a link to prev/next post>
<div>next/prev post</div>
<div><img featured image></div>
<div>post title</div>
</a>
Thank you so much in advanced for the help.