I have a custom post type which includes a custom loop output using a short code in my enfold child functions.php. All works great and my page url looks like this:
domain.com/region/east/
One thing I’ve noticed though is if my custom loop outputs pagination, the path on the paginated links is incorrect and uses this:
domain.com/region/east/2/ <- missing ‘page’ from the url
Instead of:
domain.com/region/east/page/2/ <- what it should be
I’m using avia_pagination in my custom function to output the pagination. If I enter the URL manually and include ‘page’ the pagination works as expected but because it’s not included in the generated links the pagination is broken.
I could fix this with jQuery but I was hoping there might be a php alternative.
Thanks!
Should have thought of this before asking the question:
$page_string = avia_pagination($page_number_max, 'nav');
if ( !strpos($page_string, '/page/') ) {
$page_string = preg_replace("/\/\d\//", "/page$0", $page_string);
}