Add Custom Pagination Permalink
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', 'top' );
I’m sure there’s something simply I’m missing but can’t quite get it atm, any help would be great! Thanks!