0

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!

1
0

Finally 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.