是的,你可以做到。改变<?php previous_post_link(); ?>
和<?php next_post_link(); ?>
使用以下代码:
对于以前的职位:
<?php
$prev_post = get_previous_post();
$prev_user = get_user_by( \'id\', $prev_post->post_author );
if (!empty( $prev_post )): ?>
<a href="<?php echo $prev_post->guid ?>"><?php echo $prev_post->post_title ?> (<?php echo $prev_user->first_name . \' \' . $prev_user->last_name; ?>)</a>
<?php endif ?>
下一篇文章:
<?php
$next_post = get_next_post();
$next_user = get_user_by( \'id\', $next_post->post_author );
if (!empty( $prev_post )): ?>
<a href="<?php echo $next_post->guid ?>"><?php echo $next_post->post_title ?> (<?php echo $next_user->first_name . \' \' . $next_user->last_name; ?>)</a>
<?php endif ?>
您还可以控制WordPress应该从哪些类别中选择上一篇和下一篇文章。
get_previous_post
和
get_next_post
接受两个参数:
(bool) $in_same_cat
&mdash;上一篇/下一篇文章将从与当前文章相同的类别中选择(string) $excluded_categories
&mdash;将跳过与这些类别相关的帖子find here