I am about modifying the previous post (and next post) link in W开发者_Go百科ordpress. but I don't know how to show the date of the referred post.
I don't want an external plugin for this answer, but the code in functions.php will be great. (Note: I have read this. if this is the answer how to use it in very practical code?)
the final result should be like this:
< Previous (12 June 2011) | Current Post | (14 June 2011) Next >
The following code will output the link in the correct format from your single.php template:
<?php $prev_post = get_previous_post(); ?>
<a href="<?php echo get_page_link($prev_post->ID); ?>">< (<?php echo mysql2date('d F Y', $prev_post->post_date, false) ?>) Previous</a>
I'll leave the next link as an exercise for you.
<?php echo get_the_date( 'd/m/Y' ); ?>
this will also show the date even posts within a day
精彩评论