wordpress在文章页添加上一篇下一篇方式
wordpress在文章页添加上一篇下一篇方式:
1、比较简便的代码:
上一篇: <?php next_post_link('%link');?>
下一篇: <?php previous_post_link('%link');?>
2、可以在代码里面加nofollow:
<div class="zuoyou"> <?php $current_category=get_the_category(); $prev_post = get_previous_post($current_category,''); $next_post = get_next_post($current_category,''); ?> <div class="zuo"><?php if (!empty( $prev_post )): ?>上一篇: <a rel="nofollow" href="<?php echo get_permalink( $prev_post->ID ); ?>"><?php echo $prev_post->post_title; ?></a><?php endif; ?></div> <div class="you"><?php if (!empty( $next_post )): ?>下一篇: <a rel="nofollow" href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo $next_post->post_title; ?></a><?php endif; ?></div> </div>
其中div相关的样式在使用时视情况替换去掉即可。

浙公网安备 33010602011771号