简体   繁体   English

wordpress自定义帖子类别(分类)下一个上一个链接

[英]wordpress custom post category (taxonomy) next previous link

I got custom posts with custom categories. 我收到了具有自定义类别的自定义帖子。 Categories are registered as'timeline_category' and custom po sts as timeline. 类别注册为“ timeline_category”,自定义位置注册为时间线。 I got a taxonomy page where I list all the post from given taxonomy. 我得到了一个分类页面,其中列出了给定分类中的所有帖子。

I was wondering if it's possible to create next/previous link on those taxonomy pages which will link to page with next custom taxonomy (something like next_post_link() but for custom categories). 我想知道是否有可能在这些分类页面上创建下一个/上一个链接,这些链接将链接到具有下一个自定义分类的页面(类似于next_post_link(),但用于自定义类别)。

Arek k

Try this. 尝试这个。 I used this on a shopping cart products page, I think it will work for a general situation. 我在购物车产品页面上使用了此功能,我认为它通常可以正常工作。

global $wp_query;

echo paginate_links(array(
    'base' => str_replace(999999999, '%#%', get_pagenum_link(999999999) ),
    'format' => '?paged=%#%',
    'current' => max(1, get_query_var('paged')),
    'total' => $wp_query->max_num_pages,
));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM