-
Kazys
I am doing something likely ill-advised.
Over at my web site, Varnelis.net, I have used GB to create a home page that has four tabs, three of which have query loops.
Since the query loops are only updated when a post is made (about once a week), caching seems to work well with this scheme. My questions are twofold.
Can I directly target one of the tabs to load with a URL? For example, let’s say I wanted to load the “recent art” tab first, is it possible to do so, for example with an anchor link?
Second, what happens if one day I exceed the number of posts currently set up with the query loop, for example what if I have more “recent essays” than are supported by the query loop? I could turn off pagination but that would be a bit of a bummer of course. Previously, when I had the number of items returned by the loop set lower and I clicked on page two, it would reload the whole page and you’d be sent back to the default tab.
-
Hi there,
1. Yes, you can add the ID to the Tab item of the recent art tab.
2. For question #2, try setting the query block’s Pagination type to Instant instead of Standard.
-
Hi, so I realize that there is a flaw to the way I am handling query loops.
The problem is I have one Custom Post Type called “works and projects.” I would like some of the posts to display under recent art, some under recent essays and some under both.
I wrote a snippet that targeted css classes associated with 2 query loops (one that would be the tab for recent art, the other one for recent essays), but caused was a very heavy load on my server. I have disabled it temporarily and now my site has much less trouble. It is in the private info.
The only other way I can think to do this is to create a new CPT called art and have it be separate from essays, but that makes me sad, since some essays should also be in on the recent art tab. Do you have any ideas?
-
What about using a taxonomy? The original way that I had the snippet set up was to query the taxonomy in the CPT. I have made it visible in the rest API, but I don’t see it in the query loop parameter, is there another way to see it? I could use tags, I guess.
-
Oh wow! I realized I could add a taxonomy called genre in ACF, exposed it with the Rest API, then added an include parameter to the query loop to select a genre of essays on one tab and art on the other. This is MUCH faster and much lower memory than the php snippet I used and works well. Is that the best way to go? Even though my problem is solved I will leave this for you to comment on before I close it, in case it is useful to someone.
-
Yes, using taxonomy is a better setup.
Glad you figured it out.
-
Hi, so I would like to use the following varnelis.net/#florilegium to go to appropriate tab item of the page. but maybe i have put the link in the wrong spot? any ideas? i don’t want to change the ids that read gb-tab-item-4e29a25d and so on as i am afraid that will mess things up.
-
Alvind
Hi there,
The anchor link should be attached to the Tab Item’s ID for it to work correctly.
Try replacing the default ID with
florilegium
, as the current ID associated with the Tab Item doesn’t seem to inherit any styles. There shouldn’t be any issues doing this. -
oh cool! thanks.
-
Alvind
No problem!
- You must be logged in to reply to this topic.