When viewing a post, I want to show the date of the previous post underneath the previous/next post links but $post is not available in previous_post_link().
How can I carry forward the post date from the previous post as well as get the date for the next link?
Did a bit of searching on the web, but no result. Then I opened the file wp-include/link-tempalte.php.
On line 1327 you will find
next_post_link
which callsadjacent_post_link
function.This function again calls
get_adjacent_post
function to retrieve previous post data.Looking at the source, you should be able to do the following:
This is not tested, but I think it hould work.