Dead Simple Way to Exclude Items From Query Loops in Bricks Builder (Meta Queries!)
HTML-код
- Опубликовано: 12 сен 2024
- ALERT: This is an important training. You may want to set ALL your loops up like this from the very start of every project. You might even want to make it part of your development blueprint!
There's a common challenge that you'll run into when using query loops: How can you exclude specific items from being shown but the loop when needed?
Bricks has a default control for this, but that's NOT the solution I recommend because it has scalability, maintainability, and general "hassle" issues (I'll demonstrate in this video).
The real solution involves another Bricks query loop feature that you might not be aware of or know how to use yet: meta queries.
Don't worry, it's EASY, and I'll walk you through it step by step. This solution gives you tremendous control over item visibility across your entire website.
While I used Advanced Custom Fields for this (geni.us/YYhEP), you can use Metabox (geni.us/t3UBIYH) as well.
** MY TOOLS **
🔥 AutomaticCSS (ACSS) - automaticcss.com
🔥 Frames - getframes.io
See all my recommended tools here: geary.co/tools/
** INNER CIRCLE **
Step your design/dev game up, make more money, and get the full scoop on scaling your digital agency! When it comes to the Inner Circle, I don't hold back.
⭕ In-depth design & dev trainings
⭕ Business, sales, & marketing trainings
⭕ Agency resources & downloadables
⭕ Vibrant, quality community with zero toxicity
⭕ ...and much more!
Learn more and join here: geary.co/inner...
** SOCIAL **
👉 FB - / marketingkev
👉 LinkedIn - / kevingeary
** CHAPTERS **
OH BRILLIANT! a custom field group for "visibility" alone. Before starting with Bricks, ACSS, Frames and ACF (actual hands on), I watched and learned. I got to know what was possible, knowing I could come back and get the details on how. This allowed me to design the structure and functionality ahead of time, knowing X was possible. Now that I'm 2 weeks into the new software, I'm back to add the functionality. It's been a fascinating 2 weeks now that I'm hands on.
Yes! Another gold nugget. Makes me wonder whether you'd consider making a video explaining how meta queries work in general? It's one aspect of query loops that I still struggle with. I feel like I'm getting the basic idea, but I haven't yet wrapped my head around the whole picture. Would love a tutorial.
I would also love to see Kevin's video on Query loop, Taxonomy query and Meta query, proper use of Custom fields and post types. When to use it, in what cases not to use it, because I think that I am trying to use query loop everywhere now, which ends up being too complicated, because there are too many post types and perhaps it is wrong because You can't find what You want to change/add new stuff/take off.
I did not know what meta query was until he showed me here.
Saving queries similarly to classes would be a fantastic addition!
JetEngine does this with the query builder 👌👍
Edit: you can just reference the query from the Bricks query builder. Super useful
@@WolfStackAUS Yeah, but... crocoblock.
Look up Advanced Themer, it has and its amazing
Good stuff but... is it not better to have the loop control as a custom taxonomy rather than a custom field? Querying by custom fields is not as performant as querying by taxonomy. And 'Don't show in Loops' definitely seems like a 'category' type thing (that multiple posts might belong to) rather than a custom field that is best used for displaying unique information. Querying by taxonomy makes for a faster site when you are dealing with lots of posts. A single term taxonomy can be queried super fast as you don't even need to check against a specific term, you can just check whether the post contains data (any data) for that taxonomy or if it's empty.
I don’t see it as a taxonomy. Not worried about performance unless it’s hundreds or thousands of items. This is a few items here and there - not used heavily.
This is mind-blowing. I'm not new to WP but still new to Bricks. Everytime I watch something lately, it proves I made the right move by making the switch.
I love working with CPT's and making it easier for customers. As of today, this step is also part of it.
Thank you very much.
This has opened my mind to countless possibilities of where to implement this behavior...thank you sir!
Did my own version of this about a week ago, but I like your Meta queries explanation. I also think someone did a feature request in Bricks for a Copy/Paste Queries and Conditions but I like your presets idea more. Bricks probably needs both tbh. Thanks for the content Kevin!
Kevin, you never disappoint. Great forward thinking for scalable and maintainable websites.
Your excellent tutorials have become my addiction. Thank you, dear.. ❤🙏
Kevin, this is a GREAT video to help in the situations you described. I first thought, oh just exclude from the query loop but then as you described potentially how often a loop might exist and this suggested approach, I was like "Duh, of course do it this way, this makes total sense." The Gold Nuggets continue.
Great tips. I didn’t know there was another way, this is how I have always approached hiding content. I never realized there was an “Is Null” option… spent too much time going back and resaving the content so thank you for that nugget.
This is great. Not just the loop part but I just never thought of having multiple field groups attached to a post type. I have always did a one to one. You got my head spinning with some new ways to do things.
Wow Kevin, mind blowing. This is a fantastic trick to exclude posts in a loop. Really learnt a very valuable thing today. Hats off to you. 👍🙏
Absolute gold Kevin! This is a very powerful solution using the Meta Query option 👍
I spent yesterday afternoon setting up conditions for the Hero section of a site I'm currently building so the client can control everything from ACF fields.
This tutorial has opened my mind even more to other possibilities, thanks for sharing! Love your work!
Pure website maintainability gold! Thank you Kevin! Quick question. If you "turn off" the CPT from showing in the query loop but someone directly visits the page (since it is still published for SEO) , how would you programmatically display a "Not available" or "Coming soon" notice on the CPT's page?
I’ve always wondered what those meta fields are for… Thanks Kevin!
This has been super useful in loads of places! One question I can't get my head around is whether it's possible to meta query a related post that is switched off - in other words a post linked by an ACF relationship field that is hidden from loops.
Excellent tutorial - definitely agree having preset queries would be fantastic
Thank you for this video, Kevin. I think we can exclude these items using the functions.php file and write some code there. I this case we won't have to change the conditions in each loop builder.
This content shouldn't be free..Hats off Kevin 👏👏👏
Really good video, thanks Kevin.
Thank yu Kevin for another wonderful tutorial (Simple Way to Exclude Items From Query Loops in Bricks Builder).
Hello Kevin
I've been following your channel since the beginning with oxygen builder tutorials. Believe me, I learned a lot and I'm still learning. You are creating a monster in development in wordpress :)
I want to thank you for your work and dedication in transmitting your knowledge.
Finally, I challenge you to make this calendar, which is really cool. to see how to make the relationship in the ACF.
with love from Cape Verde
Great. Just working on it for a client with an equivalent request. Was already working on metadata. But this is the solution.
You’ve got styling classes, pseudo classes…so loop classes makes perfect sense!!
Thanks so much, as usual a great tutorial - and timing perfect for me!
Totally snagging this for future builds!
Many Thanks Kevin
This really good approach, thanks for this video.
Brilliant! 👍 Info like this is so valuable.
Im yet to get here (still on L12) but really enjoying this content, thanks!
Brilliant, as always! Thanks Kevin!! 👊🏼
Hey Kevin, thanks for sharing the logic. I usually use Taxonomy for such purpose in JetEngine, mind sharing your views on why we should use meta field over taxonomy?
You can use taxonomy if you prefer it.
Damn, nice! Golden nugget time again 🤗
Genius method... A lot of thanks
Cool Kevin, I think you can do the same with a switch and a condition bricks on the loop item more simple. If it possible?
Isn’t that what I showed?
Great feature Kevin, thanks a lot ! 💪🏻
You bet!
@@Gearyco Already added to all my Blueprints 😉
Awesome man!!,, more ACF please 🙏🏻
You're a legend
It's a good approach for this specific need. But at the same time you could have different pages with different logic on wich one to hide, so it's not absolutelly wrong the bricks query exclusion way. I'm with you that in this time is better your way, but not always.
By the way, is not a critique, I love your videos and learnt a lot with you. Just wanted to say is one more excellent options, but not THE option.
Excellent tip! Thanks!
Thank you very much Kevin. Great video again. Can you also do a tutorial on Single, Archive, & category template creation video for a blog. I am trying to create a blog page my portfolio website and also want to create a blog website for myself. Watched some videos but did not work out somehow. Struggling to find good tutorial for a blog using Bricks Builder. Others' videos are confusing to me. Much appreciated if you could do a blog website tutorial.
I'll definately build that logic in all of my websites
I think that query preset is available in Advanced Themer
Jet Engine offers presets I beleive. It's done pretty well last time I checked
People that delete content because it's temporarily available, or switch to draft, drive me crazy. NEVER delete data. Links were built to that content. Google has indexed the content. Just set a flag on the page that says "not currently available" or whatever.
Great video. But I don't agree with the conditions ui. Would be better to have key > condition > value on each condition before the operator.
I agree, the ui can be improved here.
Great video as always, thanks Kevin!
*QUESTION:*
My understanding is, custom fields aren't very efficient when it comes to queries. Wouldn't it be a better approach to create this on/off state machine as a taxonomy?
Would love to hear your thoughts on this
If you need to hide lots of posts for some reason, then a taxonomy is better. I’ve never needed it for more than a few at a time.
Makes sense. Thanks! @@Gearyco
Great. More of this...
Always more coming!
Great help Kevin! I'll just go update some of my queries right now
13:55 I Looked in the Bricks Forum and didn't see your feature request. Any update on Bricks implementing this Query Preset saving feature?
Super! Thanks!
Good content.
Hi Kevin, May I know what software you use to record this video? Thank you!
Ecamm live
@@Gearyco Thanks. Congrats on your work.
I think this would be a good thing to setup up in the blue print. or what do you think?
Is this possible by using MetaBox?
Yes
Hi Kevin, I tried implementing this on my search page, but somehow it doesn't work on a search query...
Hmm. Maybe ask for help in the inner circle?
Query presets +1
Why not just change the status of the post to draft?
Because then it doesn’t exist. This is for cases where you need the post to exist, just not show in the loop.
How about instead of not displaying the "course", it adds a currently closed or unavailable banner to it?
That’s always possible, but this tutorial is about how to hide things. The class schedule thing was just a random example to have something to use.
That would be cool. Maybe you could use the Boolean logic to add a class name to a banner block. Hide by default but display if true
🙏🙏
I hate your voice, but I have to admit, your content is consistently exceptional and truly valuable.
Why would you say that?
Bricks needs an option for reusable queries like crocoblock has
You can use the query builder with bricks though
@@WolfStackAUSThe Crocoblock query builder you mean? Can I use a crocoblock query in a native bricks query loop? as opposed to a croco lisitng grid
Saving queries will change many lives hahaha, even in oxygen
Class!… no, I mean loops… no… I'm confused… loops? Where? What? logic?
Sounds like a cult.
Is there some sort of inner circle?
Yes, but you have to do a human sacrifice before you’re allowed in.
@@Gearyco On it. Plenty of candidates to choose from.
How is Rob
🤫
Classes are courses of course, but you'll only understand if you're in the loop 😁
I just wish I had all your website related knowledge and experience
One day!