I was hoping for some advice on the best way to go about using tabs within WordPress.
I have 4 categories which I’d like to separate using tabs, but if I use tabs I’m afraid that it will slow the page load down as all 4 loops would have to load in their respective posts within each tab. The first tab is ‘All’ and then the following 3 are categories, but essentially each post would be loaded once by the ‘All’ loop and then again in each category before the page fully loads.
Would it be a better idea to use 1 loop along with an if statement which has a variable that is changed onclick by each tab, when each tab is pressed it changes the variable which changes the category within ‘query_posts’ and reruns the loop. The first option would be easier to set up but I’m worried about load time once the number of posts gets high.
Anyone got any suggestions/advice? Or just their 2 cents. To give you an idea of what I’m trying to achieve please check out the Fantasy Interactive site here: http://www.f-i.com/work If you click on ‘Sort our work’ on the top of the middle column then you get the gist of it.
So after a little research I realized that I can’t rerun the loop with a JS variable without refreshing the page, so that option is out. Would using AJAX to bypass a page refresh and save on initial page load work in this situation?
@clokey2k, thanks for that link, looks like a great solution, I’m going to try that out using the tag names within each post’s post_class to categorize them.