我已经看到了与此非常相似的帖子以及许多其他示例,例如此处的自定义函数的 wordpress 文档: 下一个/上一个帖子链接的函数参考
但是,我的示例位于 Storefront (woothemes) 主题中的自定义函数中,因此在不破坏功能的情况下以正确的方式合并“$in_same_term = true”时遇到了麻烦。这是主题中“post.php”文件中的(原始)代码,我认为我需要以某种方式合并“$in_same_term = true”,...
if ( ! function_exists( 'storefront_paging_nav' ) ) {
/**
* Display navigation to next/previous set of posts when applicable.
*/
function storefront_paging_nav() {
global $wp_query;
$args = array(
'type' => 'list',
'next_text' => _x( 'Next', 'Next post', 'storefront' ) . ' <span class="meta-nav">→</span>',
'prev_text' => '<span class="meta-nav">←</span> ' . _x( 'Previous', 'Previous post', 'storefront' ),
);
the_posts_pagination( $args );
}
if ( ! function_exists( 'storefront_post_nav' ) ) {
/**
* Display navigation to next/previous post when applicable.
*/
function storefront_post_nav() {
$args = array(
'next_text' => '%title <span class="meta-nav">→</span>',
'prev_text' => '<span class="meta-nav">←</span> %title',
);
the_post_navigation( $args );
}
}
我想我可能会很接近,因为大量搜索揭示了相同类型的信息,我只是没有正确整合它......
提前感谢您提供有关如何最好地整合此功能的任何建议!