您可以使用get_adjacent_post
用于检索该数据的函数。此函数用于检索相邻立柱。可以是下一篇文章,也可以是上一篇文章。
For previous post
<?php
$prevpost = get_adjacent_post( false, \'\', true, \'category\' );
$image = get_the_post_thumbnail( $prevpost );
$name = get_the_title( $prevpost );
$url = get_permalink( $prevpost );
?>
For next post
<?php
$nextpost = get_adjacent_post( false, \'\', false, \'category\' );
$image = get_the_post_thumbnail( $nextpost );
$name = get_the_title( $nextpost );
$url = get_permalink( $nextpost );
?>