在WordPress不支持的导航栏中加下划线';更新文本

在WordPress不支持的导航栏中加下划线';更新文本,wordpress,underscores-wp,Wordpress,Underscores Wp,我们似乎根本无法让template-tags.php和_posts_导航功能关注基本编辑: 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

我们似乎根本无法让template-tags.php和_posts_导航功能关注基本编辑:

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;
如果(!function_存在('the_posts_navigation')):
/**
*如果适用,显示下一组/上一组帖子的导航。
*
*@todo在释放WordPress 4.3时删除此功能。
*/
函数的作用是发布导航(){
//如果只有一页,请不要打印空标记。
如果($GLOBALS['wp\u query']->max\u num\u pages<2){
返回;
}
?>

template-tags.php文件中的函数似乎只与WordPress 4.1之前的版本兼容,它们是WordPress核心的一部分


使用_posts_pagination()和/或next_posts_link()/previous_posts_link()足够有效。

在4.1中,Wordpress似乎在其核心功能中添加了“发布”导航。在此之前,它并不存在,并且实际上在template-tags.php中使用了一个同名函数。因此,现在,它不再调用以前的自定义函数,而是默认为Wordpress版本,基本上是ignoring template-tags.php中的一个

为了解决这个问题,我只是更改了_s函数的名称。就我个人而言,我切掉了“the”,使它成为template-tags.php中的posts_导航,然后在主题中引用它的任何地方(index.php、single.php等)。我对template-tags.php中的函数所做的任何更改(添加我自己的箭头图标)都非常有效就出现了