Is there a way to have pagination on multiple tabs?
I have a page the has 5 tabs, each tab has filtered content from the same posts. For example:
Tab 1 – All Posts.
Tab 2 – Posts with Keyword One.
Tab 3 – Posts with Keyword Two.
etc…
My problem is that I can’t figure out how to use pagination on each tab and have the user be able to select the page on that tab and stay on that tab – it wants to go back to the first tab.
Use the following extension to the
WP_Query
class.The extension only takes your arguments as an array, rather than a string format.
You’ll to add individual values for “page_link” for each of your tabs. This should just be a string (“tab1”, “tab2” etc etc)
Then you’ll need to use the
$my_query->next()
and$my_query->prev()
to add page turning links to each tab.Code Also Here
You’d have to return an array from paginate_links(), check the url for a fragment identifier then append that to your array before output.