我们似乎根本无法让 template-tags.php the_posts_navigation 函数来关心基本编辑:
if ( ! function_exists( 'the_posts_navigation' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*
* @todo Remove this function when WordPress 4.3 is released.
*/
function the_posts_navigation() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
?>
<nav class="navigation posts-navigation" role="navigation">
<h2 class="screen-reader-text"><?php _e( 'Posts navigation', 'mytheme' ); ?></h2>
<div class="nav-links">
<?php if ( get_next_posts_link() ) : ?>
<div class="nav-previous"><?php next_posts_link( __( 'Older posts!!', 'mytheme' ) ); ?></div>
<?php endif; ?>
<?php if ( get_previous_posts_link() ) : ?>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts!!', 'mytheme' ) ); ?></div>
<?php endif; ?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
<?php
}
endif;
如您所见,我们在帖子链接中添加了一些感叹号,但 WordPress 在前端可能不太关心。它应该显示在 index.php 上,那里有很多帖子可以看到,并且它固执地只显示“帖子导航”作为主标题和“旧帖子”。
请帮忙!谢谢!