I'm getting challenge with the previous_post_link() and next_post_link() functionality. When there's no previous publish, the function previous_post_link() doesn't display a hyperlink, likewise for that next_post_link() and also the last publish. I must possess a placeholder image to ensure that the look stays consistent.

Presently I've images of eco-friendly arrows pointing right and left, I must place a picture of the gray arrow if you will find forget about posts to return to.

It is possible to method to make use of the next_post_link()/previous_post_link() functions but do not have the link removed.

I additionally question if there's a means for that links to cycle, to ensure that should you arrived at the newest publish, the following publish link will bring you to the very first publish.

**** Up-to-date ****

This is actually the code, according to "silent's" advice (recognized answer) to make use of get_adjacent_post():

    if(get_adjacent_post(false, '', true)) { 
        previous_post_link('%link','<img src="larr.gif"/>'); 
    else { 
        echo '<img src="larr2.gif"/>'; 

    if(get_adjacent_post(false, '', false)) { 
        next_post_link('%link','<img src="rarr.gif"/>'); 
    else { 
        echo '<img src="rarr2.gif">'; 

So that you can "capture" what [cde] and [cde] return using [cde] and [cde], then use a conditional into it.

Code used:


I never do this myself. However, you might make reference to this post. It uses get_adjacent_post().

Why cant you attempt the below?


Alternatively to show Next and former Publish Links to Blog publish it is simple to do this. This is well described at globinch.com (WordPress Tips : How you can Add Next and former Publish Links to Blog? )