Firstly; I have searched high and low for a solution to the problem I am having (over the last 2-3 weeks), but nothing I have done has been able to get the pagination working for a post displaying a grid of posts. I would include more links in this post (including website in question) but I am limited to posting 2 urls.
(The theme being used is Divi, by Elegant Themes. ..child theme is being used)
So:
I have created a CPT and am using Advanced Custom Fields (ACF) to enable a simple admin page for the user to enter details (for each new post). This creates the new post of the CPT.
Posts that are created with this CPT are automatically listed on a 'Travel Blog' page in grid format. (..removed site URL..)
When a post from the Travel Blog page is selected for viewing, it displays an introductory page [post] that displays a grid of all blog posts with the category that is relevant for that page (trip) - not the CPT. It is this page where I would like the pagination, and these are the pages where the problem is.
The code for creating the CPT and for displaying the grid of posts is the following: http://pastebin.com/mM3XPUHM
This page (amongst many many others I have read) would appear the best resource I can find, but maybe there is something I haven't understood? How to fix pagination for custom loops?
Maybe some useful info
- the page displaying the post grid to be paginated is a Post as opposed to a page (with reference to WP terminology)
the grid of posts being displayed (where pagination is not working) are not of the CPT. They are displayed as per the relevant category - an ACF variable
when mouse pointer hovers over 'Older Posts' link, url is shown with '/page/2/' added, but when clicked, the first initial page is shown
if tested, the variable of 'max_num_pages' will return a number greater than 1, so there are numerous pages to display
I am not able to manually enter the URL with /page/2/ added, in the address bar. Initial page is displayed.
if I enter a fixed category for the post grid (as opposed to the ACF variable) it makes no difference, except for displaying a grid of posts of the same category on each page
if I enter a number for 'paged' in code. eg. '$args['paged'] = 3' the third page will actually be displayed
-- with the previously mentioned test, the link for 'Newer Posts' is still not displayed. Only 'Older Posts' is displayed.
I realise this is probably a reasonably long post and maybe there are still important details I have not mentioned, but here's hoping that someone might have some suggestions.
Thanks
Progress Edit:
While reading the WP codex for pagination it suggested setting permalinks to default, so I set to plain (I did have 'Post Name' selected) and the pagination actually works. I would much prefer using 'Post name' for permalinks, but hopefully this should help with fault finding.