If you have a look at what next_post_link
you’ll see that it takes a parameter $link
as the second argument:
next_post_link( $format, $link, $in_same_term = false, $excluded_terms="", $taxonomy = 'category' );
Your parameter for this currently doesn’t include the post thumbnail:
_x( '%title <span class="meta-nav">→</span>', 'Next post link', 'nicosite' )
So we need to add it like this:
$nextPost = get_next_post(true); // You are aware that this only checks for next posts in the same term, right?
if(!empty($nextPost) ){ //This is to check if there is a next post
$nextthumbnail = get_the_post_thumbnail($nextPost->ID, array(300,150) );
}else{
$nextthumbnail="";
}
next_post_link( '<div class="nav-next">%link</div>', $nextthumbnail . _x( '%title <span class="meta-nav">→</span>', 'Next post link', nicosite' ) );
Related Posts:
- previous / next post with thumbnail
- Is it possible to nest get_previous_post()?
- Next Prev Post link rendering current post thumbnail
- Show prev and next post links for parent post of current image in attachment page?
- Showing Thumbnail from Previous and Next Posts
- Featured Image Link to next post?
- Add class name to post thumbnail
- Delete original image – keep thumbnail?
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- Get Previous & Next posts by Post ID
- How to add multiple image sizes of the same size with add_image_size
- change set_post_thumbnail_size according to post type admin page
- Getting Thumbnail Path rather than Image Tag
- How to crop thumbnail height to auto with set width
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- Image uploader with “Set Featured Image” link on front end
- adding an id to the_post_thumbnail
- How can I display my featured image correctly inside my single posts?
- Featured image upload finished hook
- Generate thumbnail for images with the same size as thumbnails
- Implementing Zurb’s Interchange Into WordPress
- How to get_posts having post thumbnail?
- Display the first image from a post in RSS feed
- Filter For Featured Image
- add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2
- Add body class based on existance of post thumbnail. Code works but receiving PHP Notice
- Delete all thumbnails for a post
- How to display thumbnail + tags + title of a child page?
- Archive Thumbnail Gallery
- How to delete posts that does not have a thumbnail?
- connect last post with first post
- WordPress Uploader Editor shows broken image
- How do i show wordpress attachments from current post?
- “next_posts_link” and “previous_posts_link” display me NOTHING
- Can’t get image size set with set_post_thumbnail_size() function
- Show LightBox when clicking on featured image [closed]
- Add #anchor to next/previous_post_link
- Get ID of featured image using “get_post_thumbnail_id(the_ID())” – without printing to screen?
- what is the difference between timthumb and post thumbnail?
- Duplicated featured image is not showing
- Create thumbnail size only for a few images?
- Else condition not working while using has_post_thumbnail
- Only Display Thumbnail if Larger Than
- WP Query to set post thumbnail for existing old posts
- get_post_thumbnail_id() Doesn’t return value [closed]
- Why is the post title and content automatically being displayed in the post thumbnail (Featured image)?
- get_next_post_link() and get_previous_post_link() return wrong posts
- How to deal with wordpress images?
- Disable post thumbnails in Twenty Thirteen child theme
- How can I find the first post in a category that has a featured image and then return the get_the_post_thumbnail()?
- Post thumbnail throwing size limit parameters in
- How do I add a default thumbnail to elseif when no get_field(‘photos’), and no post thumbnail exists?
- Single.php Category Post Count
- Problem with showing featured image
- Getting img src from thumbnail_id using javascript
- Easy way to update a single translation entry without having to translate
- Featured image not working
- Insert post’s category name into thumbnail string
- WordPress post next/prev not working
- Thumbnails in ACF Query Results
- Icon over thumbnail according to post format
- Is it possible to add the_post_thumbnail to style.css?
- Getting featured image of particular size.
- Different thumbnails for index and article page
- Get post featured image id with $wpdb
- Attachment Image using wrong src?
- Unable to set Custom “Link URL” for Featured Image, and More?
- On what point (hook) does the_/has_post_thumbnail() load?
- First Image not loading on Mobile Version of Website
- 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?
- Thumbnails not being generated for PDF files
- Make 1st Slide of PowerPoint file to be the Post thumbnail preview image
- Is it possible to set Featured Image using HTML?
- Using previous_post_link next_post_link but with a filter on a custom field
- Set featured image from auto generated video thumbnail url php
- Use Post Title as alt text for Featured Image
- WordPress default srcset with hard crop
- Conditionally (cpt) filter previous and next_post_link
- wp_get_attachment_metadata()[‘image_meta’] fetch WP metadata or EXIF?
- White Blank screen and issue to get thumbnail in
- Post thumbnail on specific template
- Using lower resolution/size images for thumbnails on posts index
- How to have featured image show in standard RSS Widget
- Link from Thumbnail to Post not working
- Featured Image metabox (postimagediv) doesn’t appears when it should
- Thumbnails not showing in blog
- Featured Image inserted through custom query, does not show up
- How to import linked images and make them featured -> automagically
- Change role’s settings influence post-thumbnail
- Wrap Featured Image in a Link
- Thumbnail images
- Featured Image Thumbnail Sizing
- Featured Image Isn’t showing with cropped, How to show it?
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]
- How to add text & call to action button to featured image on homepage?
- Featured image as background in a div using headway
- Retrieving next_post_link() and previous_post_link() in functions.php
- php code for image fetching
- Hot to change resized image link on posts