I'm trying to create a page with multiple loops on it and as such also need multiple pagination.
This is proving to be a touch difficult, I've managed to get the links to show correctly by using the following code:
$products_paginate_args = array(
'format' => 'products_page/%#%',
'current' => $products_page,
'total' => $products_query->max_num_pages,
'add_args' => $query_args
);
echo paginate_links($products_paginate_args);
So this shows links to /products_page/page_number and works properly - the trouble is coming that of course that permalink structure isn't recognised so results in a not found error.
I've had a go at sorting this out by using add_rewrite_tag
but it doesn't appear to be working for me. I've dropped the following code in to my functions.php
file to try to get this permalink structure recognised but still no luck:
add_rewrite_rule(
'products_page/([0-9]+)?/?$',
'index.php?paged=$matches[1]',
'top'
);
I'm sure there's something simply I'm missing but can't quite get it atm, any help would be great! Thanks!
I'm trying to create a page with multiple loops on it and as such also need multiple pagination.
This is proving to be a touch difficult, I've managed to get the links to show correctly by using the following code:
$products_paginate_args = array(
'format' => 'products_page/%#%',
'current' => $products_page,
'total' => $products_query->max_num_pages,
'add_args' => $query_args
);
echo paginate_links($products_paginate_args);
So this shows links to /products_page/page_number and works properly - the trouble is coming that of course that permalink structure isn't recognised so results in a not found error.
I've had a go at sorting this out by using add_rewrite_tag
but it doesn't appear to be working for me. I've dropped the following code in to my functions.php
file to try to get this permalink structure recognised but still no luck:
add_rewrite_rule(
'products_page/([0-9]+)?/?$',
'index.php?paged=$matches[1]',
'top'
);
I'm sure there's something simply I'm missing but can't quite get it atm, any help would be great! Thanks!
Share Improve this question edited Dec 10, 2014 at 17:13 0Neji asked Dec 10, 2014 at 17:02 0Neji0Neji 2031 gold badge3 silver badges11 bronze badges 1- It might actually be easier using Ajax but if you're dedicated to this, maybe this link will help: Multiple WP_Query Loops w/ Pagination. – Howdy_McGee ♦ Commented Dec 10, 2014 at 18:35
1 Answer
Reset to default 0Finally got this working nicely, this specific issue was just down to not flushing the rewrite rules (gets me everytime!) so it was fixed by simply navigating to the 'Permalinks' page in the WP admin area.