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.