If I’m understanding this correctly, you may just want to use something like:
$prev = get_previous_post();
$next = get_next_post();
Then to access the title you’d do something like
<h1><?php echo $prev->post_title ?></h1>
And if you wanted its image:
$prev_img = get_post_thumbnail_id( $prev->ID );
<img src="https://wordpress.stackexchange.com/questions/248644/<?php echo $prev_img; ?>" alt="your alt here">
Related Posts:
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- is it possible to get next_post_link
- Get Previous & Next posts by Post ID
- How can I add title attributes to next and previous post link functions?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- Thumbnail (featured image) of next and previous post is not being properly displayed!
- How to use next_post_link and previous_post_link on single posts in search results
- How can I get next post id after current post id for custom post type
- adding custom fields to next and previous post link
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Using previous_post_link and next_post_link to wrap around post sequence
- Disable “previous link” in first post and “next link” in last post
- previous / next post with thumbnail
- WordPress previous_post_link exclude posts with multiple categories
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Working with Next and Prev links in Single Taxonomy Templates
- How to make my pagination loop continuously?
- Next and Previous links on a single taxonomy page only link to same term
- Get attachment next and previous by author only
- connect last post with first post
- previous_post_link() next_post_link() arrow position
- “next_posts_link” and “previous_posts_link” display me NOTHING
- Can I use get_adjacent_post for specific categories?
- Add #anchor to next/previous_post_link
- List all blog categories
- Next and/or previous post content
- A garbled copy of MY blog on this site? [closed]
- Deleting a blog
- Why does this snippet in a blog post make WordPress crash?
- Where can I find my blog page?
- Using ‘previous_post_link()’ & ‘next_post_link()’ on single attachment pages
- get_adjacent_post – in same term or category not working
- next_post_link and previous_post_link order not working properly
- get_next_post_link() and get_previous_post_link() return wrong posts
- WordPress Blog – Grid View
- How to show latest blog post rather then earliest
- WordPress next/prev links Issue
- next_post_link / previous_post_link not working with WP_Query
- How to exclude or filter password protected posts when using next_post_link() previous_post_link
- Single.php Category Post Count
- Add Previous/Next Buttons to CPT Single Pages Only
- Removing blog page images
- How to make blog posts appear under different menu items?
- Portfolio & Blog cohabitation : multiple single.php files?
- WordPress post pagination continuous [duplicate]
- I want to display my 2. latest post
- Why the Gutenberg Editor is Not Available In My WP Site?
- Get previous/next post from (specific) category
- WordPress post next/prev not working
- Get next post in same category not working WP 4.7.4
- How do I add a sign up form to my blog?
- WordPress blog assign unqiue body class
- Tweak next_post_link for it to include thumbnail
- Fetching All Posts (200+) in a Category – Performance Issues?
- Recent Posts Listed by Author, Can I exclude authors?
- How to modify display of blog listing page?
- Can’t get the previous and next posts permalink
- navigation among single posts
- Next/Previous links doesn’t work in the same category
- How do I display a greyed out next_post_link when there is no next post
- Can I make a parent page of the blog and have it display a paragraph/thumbnail of certain entries?
- pagination links not displaying
- How can I set a vote on the comments?
- 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?
- next/previous post links for specific category when post belongs to multiple categories
- what is the address of default home page?
- Prev/Next Navigation on Single Post Disappeared for Custom Post Type
- Creating new page overwrites old page
- Show category in Previous/Next links
- Change URL of previous posts and next posts link in WordPress
- Blogs got Deleted automatically
- Integrate wordpress blog into existing html site
- Dynamic next and previous post links
- Back, Next, and Previous links for the REFERRING term archive
- get_previous_post_link and get_next_post_link of custom post type that share custom field value
- How to filter get previous post function by meta value DESC and post date DESC?
- previous and next post of same category on singlepost.php
- Blog post stuck in drafts
- I Have No List Of Blogs – Empty Blog Folder Recreating Itself
- Conditionally (cpt) filter previous and next_post_link
- How to change the layout of blog posts to that a compressed snippet shows rather than full text
- How to create library of HTML snippets to use in posts
- WordPress not showing pagination links
- Adding a WordPress Blog to a current WordPress site
- Two blogs one page
- Blog Displays Only Sticky Posts
- Uploading a external squeeze page within WP
- previous_posts_link returns null when querying custom post type
- Multiple next / previous
- single post navigation order (NOT chronological)
- How to add a class and title attribute to the link generated by next/previous post
- Fatal error: require() [function.require]: Failed opening required in wordpress
- Auto-posting Facebook posts to blog [closed]
- How to access the so called “Posts page”
- Home page of blog displays no posts
- Retrieving next_post_link() and previous_post_link() in functions.php
- how to implement next/prev within category archive?
- How to turn off “you have to login to comment” on blogs
- Next/previous post link to posts only within one or more specific categories
- How to add thumbnail support to WordPress next / previous post loop?