我想添加下一篇文章和上一篇文章链接我的每篇文章。我已经这样做了。但我希望最后一次发帖时下一个帖子链接将隐藏,第一次发帖时间上一个帖子将被隐藏
下面我的代码正在工作......
<?php
$prev_post = get_previous_post();
if (!empty( $prev_post )): ?>
<a href="<?php echo get_permalink( $prev_post->ID ); ?>" title="<?php echo $prev_post->post_title; ?>" class="prev-post">
<span class="left_arrow"></span> <?php _e("Previous Post", "twentytwelve"); ?></a>
<?php endif; ?>
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>" title="<?php echo $next_post->post_title; ?>" class="next-post">
<?php _e("Next Post", "twentytwelve"); ?> <span class="right_arrow"></span></a>
<?php endif; ?>
波纹管一个假设工作,但不是。
<?php if($show_prevnext_post == 1) { ?>
<?php
$prev_post = get_previous_post();
if (!empty( $prev_post )): ?>
<a href="<?php echo get_permalink( $prev_post->ID ); ?>" title="<?php echo $prev_post->post_title; ?>" class="prev-post">
<span class="left_arrow"></span> <?php _e("Previous Post", "twentytwelve"); ?></a>
<?php endif; ?>
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<a href="<?php echo get_permalink( $next_post->ID ); ?>" title="<?php echo $next_post->post_title; ?>" class="next-post">
<?php _e("Next Post", "twentytwelve"); ?> <span class="right_arrow"></span></a>
<?php endif; ?>
<?php } ?>
我不明白为什么这不起作用。我是否需要function.php中的任何内容