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
- Filter next_post_link() and previous_post_link() by meta_key?
- Can you have a blog in a subdirectory hosted on a different server?
- How can I add title attributes to next and previous post link functions?
- How to get next and previous post links, alphabetically by title, across post types, in a shortcode
- get_adjacent_post alternative on a very large db
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- next and previous post link ordered alphabetically
- Thumbnail (featured image) of next and previous post is not being properly displayed!
- How can I limit the length of the previous/next posts in my WordPress Theme?
- How to use next_post_link and previous_post_link on single posts in search results
- Next/Previous Posts Links: Alphabetically and from Same Category
- How can I get next post id after current post id for custom post type
- Problem excluding category from get_next_post
- Move WordPress from /blog folder to root but leave post at /blog
- Why is previous_post_link and next_post_link working outside of the Loop?
- Moving my current wordpress blog to a subdomain
- 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
- 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?
- WordPress previous_post_link exclude posts with multiple categories
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Showing Thumbnail from Previous and Next Posts
- Next and prev. post link ONLY within category
- Working with Next and Prev links in Single Taxonomy Templates
- Could not load the preview image. Please reload the page and try again – error on image upload
- How to make my pagination loop continuously?
- How to display blog posts on a dedicated page?
- Two Blog Layouts, Same Theme
- Previous/Next Post Within the Category?
- Show first sentence of blog post in blog roll
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- 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
- Keep WYSIWYG on Blog Page
- “next_posts_link” and “previous_posts_link” display me NOTHING
- Detect archive and category page
- Custom URL for all posts in WordPress
- 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]
- A different thumbnail to the blog index vs. the image on the top of a post?
- Previous_post and Next_post – Custom Post Type
- Deleting a blog
- 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
- 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?
- Why does this snippet in a blog post make WordPress crash?
- How to move all theme templates into a subfolder WP
- Next and Previous Posts of Same Parent
- Show category from “Next post” and “Previous post” [edited]
- Where can I find my blog page?
- previous/next_post_link in the same sub-category?
- How to display the posts and news in front page?
- Using ‘previous_post_link()’ & ‘next_post_link()’ on single attachment pages
- How do I change the taglines next to the featured image on my posts?
- 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
- next_post_link and previous_post_link order not working properly
- Get Adjacent Post By Tag
- 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
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- WordPress next/prev links Issue
- Modify previous and next post links to current Authors Other posts
- Link to the next/prev posts in index loop in same category?
- next_post_link / previous_post_link not working with WP_Query
- Displaying the author of next and previous posts in pagination?
- inviting people to blog and editing roles
- Single: Prev and next Post in same order as main query, in all categories
- How to exclude or filter password protected posts when using next_post_link() previous_post_link
- Single.php Category Post Count
- Why are previous_post_link/next_post_link skipping some posts?
- Add Previous/Next Buttons to CPT Single Pages Only
- Removing blog page images
- problem with wordpress author profile page URL
- query_posts pagination will always show identical content
- How to make blog posts appear under different menu items?
- Portfolio & Blog cohabitation : multiple single.php files?
- WordPress post pagination continuous [duplicate]
- How to add list of other blogs, with latest posts from those blogs, to a single page of my website?
- Put post urls into their own category
- 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