admin管理员组文章数量:1402331
I have a custom post type called "catalog". This page, when viewed, has a section in the page that lists items from another cpt, items from the current catalog being viewed.
What I am trying to do, is add paging, so that if there are more than 12 items from that catalog, the remaining items are paged.
WordPress has created the following rewrite rules:
[catalog/([^/]+)/page/?([0-9]{1,})/?$] => index.php?catalog=$matches[1]&paged=$matches[2] ... [catalog/([^/]+)(?:/([0-9]+))?/?$] => index.php?catalog=$matches[1]&page=$matches[2]
So, if I am reading the above correctly, WordPress is already set up to handle:
/catalog/{catalog_slug}/page/2/
/catalog/{catalog_slug}/2/
Yet when I attempt to load this page, it always drops the /page/2/ from the URL and redirects to: /catalog/{catalog_slug/
Thus making it impossible for me to access the page variable.
How can I implement paging on a single post page, so that I can page the catalog items displayed?
Thanks
I have a custom post type called "catalog". This page, when viewed, has a section in the page that lists items from another cpt, items from the current catalog being viewed.
What I am trying to do, is add paging, so that if there are more than 12 items from that catalog, the remaining items are paged.
WordPress has created the following rewrite rules:
[catalog/([^/]+)/page/?([0-9]{1,})/?$] => index.php?catalog=$matches[1]&paged=$matches[2] ... [catalog/([^/]+)(?:/([0-9]+))?/?$] => index.php?catalog=$matches[1]&page=$matches[2]
So, if I am reading the above correctly, WordPress is already set up to handle:
/catalog/{catalog_slug}/page/2/
/catalog/{catalog_slug}/2/
Yet when I attempt to load this page, it always drops the /page/2/ from the URL and redirects to: /catalog/{catalog_slug/
Thus making it impossible for me to access the page variable.
How can I implement paging on a single post page, so that I can page the catalog items displayed?
Thanks
Share Improve this question asked Apr 2 at 12:34 BradBrad 1137 bronze badges 1- The CPTs are registered via ACF, and I believe is already of type page not post. I will review. I am showing the related posts from another CPT via a custom WPQuery loop. – Brad Commented Apr 3 at 1:36
1 Answer
Reset to default 0Well, I was able to solve this with a custom query string parameter: ?view=2 for the 2nd page, that just seems cludgy when the system already has a route for /page/2/ for example. It's even more annoying to me that ?page= and ?p=, the most logical names for a paging query parameter, don't work. Wordpress refuses to accept those and strips them from the URL.
本文标签: queryTrying to Add Paging to Single Post Page
版权声明:本文标题:query - Trying to Add Paging to Single Post Page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744339915a2601415.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论