Wherever you want to place your image:
<?php get_the_post_thumbnail( get_previous_post(), [ 150, 150 ] ) ; ?>
<?php get_the_post_thumbnail( get_next_post(), [ 150, 150 ] ) ; ?>
You can replace the sizes [ 150, 150 ]
with the 'thumbnail'
.
Edit: The code that works for me:
$next_post = get_next_post();
$previous_post = get_previous_post();
the_post_navigation(
array(
'prev_text' => '<div class="post-thumb">' . get_the_post_thumbnail( $previous_post, [ 150, 150 ] ). '</div><div class="post-text"><p class="meta-nav">' . esc_html__( 'Previous post', 'lang' ) . '</p><p class="post-title">%title</p></div>',
'next_text' => '<div class="post-text"><p class="meta-nav">' . esc_html__( 'Next post', 'lang' ) . '</p><p class="post-title">%title</p></div><div class="post-thumb">'. get_the_post_thumbnail( $next_post, [ 150, 150 ] ) . '</div>',
)
);
Related Posts:
- How to get next and previous post links, alphabetically by title, across post types, in a shortcode
- Thumbnail (featured image) of next and previous post is not being properly displayed!
- Next/Previous Posts Links: Alphabetically and from Same Category
- Why is previous_post_link and next_post_link working outside of the Loop?
- Disable “previous link” in first post and “next link” in last post
- Next and prev. post link ONLY within category
- Previous/Next Post Within the Category?
- previous_post_link() next_post_link() arrow position
- Add #anchor to next/previous_post_link
- Using ‘previous_post_link()’ & ‘next_post_link()’ on single attachment pages
- get_next_post_link() and get_previous_post_link() return wrong posts
- WordPress next/prev links Issue
- Single: Prev and next Post in same order as main query, in all categories
- Get previous/next post from (specific) category
- altering %title
- Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link )
- next/previous post links for specific category when post belongs to multiple categories
- Show category in Previous/Next links
- How to Navigate within Category? Lot of codes here on stackexchange didn’t work
- Multiple next / previous
- Single post navigation Previous post link shows up but Next post link doesn’t
- Next/previous post link to posts only within one or more specific categories
- Filter next_post_link() and previous_post_link() by meta_key?
- How can I add title attributes to next and previous post link functions?
- get_adjacent_post alternative on a very large db
- next and previous post link ordered alphabetically
- How can I limit the length of the previous/next posts in my WordPress Theme?
- Problem excluding category from get_next_post
- Next and previous link in custom post type in the same taxonomy term
- previous / next post with thumbnail
- excluded_categories parameter in next_post_link() behaving unexpectedly
- next_posts_link not working in custom loop
- Making next_posts_link(); return posts by month
- Show prev and next post links for parent post of current image in attachment page?
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Showing Thumbnail from Previous and Next Posts
- How to make my pagination loop continuously?
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- WordPress “Next Post” URL and Thumbnail
- Previous_post and Next_post – Custom Post Type
- next_post_link for CPT only working for a few posts? weird!
- Is it possible to nest get_previous_post()?
- Exclude Posts From Specific Category from Next and Previous post links
- get rid of the arrow in previous_post_link?
- Is it possible to skip certain specified pages when using < prev and next > links?
- Why do next pages load the same content rather then older articles?
- Change OR logic of get_adjacent_post into AND
- Next and Previous Posts of Same Parent
- Show category from “Next post” and “Previous post” [edited]
- previous/next_post_link in the same sub-category?
- Previous/next post links displaying wrong category than is desired
- Next Posts Prev Posts for Standard post format only
- get_adjacent_post – in same term or category not working
- Get Adjacent Post By Tag
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- Modify previous and next post links to current Authors Other posts
- Link to the next/prev posts in index loop in same category?
- Displaying the author of next and previous posts in pagination?
- How to exclude or filter password protected posts when using next_post_link() previous_post_link
- Why are previous_post_link/next_post_link skipping some posts?
- query_posts pagination will always show identical content
- WordPress post pagination continuous [duplicate]
- Get ID for previous/next image link
- Pagination for custom loop on custom page template is not displaying anything
- get_adjacent_post – in same term not working
- Custom Posts and Posts – next_post_link and previous_post_link not working together
- using images in next/previous_post_link [closed]
- Display next 3 posts based on custom taxonomy
- Next Prev Post link rendering current post thumbnail
- grab neighboring content in a query
- WP_Query and pagination AGAIN?
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- Next/Previous Product with custom order by price & products inside the product category [closed]
- Trying to get_adjacent_post – in same category not working
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Order by post_date does not work in Previous and Next post pagination
- Infinite next / prev post in single.php page
- How to exclude posts by meta key value in the_post_navigation next prev links?
- Change URL of previous posts and next posts link in WordPress
- Using previous_post_link next_post_link but with a filter on a custom field
- make random internal linking in the middle of posting
- next_posts_link not visible on first page
- Previous/Next custom post links within custom taxonomy
- How to know if the most recent article
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- Why is one of my posts prefixed with “Next Post” on Google search
- How do I use the add_query_arg function in a template tag like previous_post_link?
- Conditionally (cpt) filter previous and next_post_link
- Next/Previous Post Links in single-[custom-post-type].php file
- using next-page and previous page inside a wp_query
- show previous/next post orderer by title in custom post types
- customize urls displayed by previous_post_link and next_post_link
- Post in multiple categories do not include in previous / next post if one category in excluded
- Change next_post and previous_link to navigate throught parent categories only
- how to add previous and next link for the posts?
- pagination/prev and next page links not showing
- Multiple loops using next_posts_link & previous_posts_link
- Retrieving next_post_link() and previous_post_link() in functions.php
- how to implement next/prev within category archive?
- on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query