Archived topic
Elements custom block sidebars override rules
11 replies · Started by André on May 27, 2021
Hi there!
I have a blog with many Categories and I am building a custom sidebar for some of them with Elements (Block - Right Sidebar).
So, lets say I have the following:
- Category A » Sibebar A
- Category B » Sibebar B
- Category C » Sibebar C
- Etc
I have set Location Rules for each sidebar:
- Sidebar A: Post Category A + Post Category Archive A
- Sidebar B: Post Category B + Post Category Archive B
- Sidebar C: Post Category C + Post Category Archive C
- Etc
All good until now and these customs sidebars are working properly.
The different Elements custom sidebars are showing in A, B, C, etc categories posts and the default WP “widgetized” sidebar in all other posts that don’t have a custom sidebar.
But I want also to replace the default WP “widgetized” sidebar with an Elements sidebar. I have built one general right sidebar and set the Location Rule to “Entire site”. And, as I expected, this rule overrides all the others and this general sidebar shows in all posts, in all categories.
In other words, I want to:
1. Replace my default WP sidebar with different custom Elements sidebars for some post categories
2. Have a fall-back Elements custom sidebar to show in all other posts
I understand that I can add exclusion rules to the general/fall-back sidebar for all the categories with custom sidebars, but that would mean a lot of manual work.
Do you have any other suggestions how can I achieved this? Is there a way to prioritize location rules so that one doesnt overrides the other?
Sounds confusing but I hope I was clear enough.
Thanks,
André
Hi there,
just to explore the options - a quick question.
How does the Entire Site Sidebar compare to the other sidebars - Does the content in this sidebar also display in your Category specific sidebars ? Or is it completely different?
Hi David! Thanks for your reply.
I this case, it's (almost) completely different. For example, in the Entire Site Sidebar I will have a generic banner promoting a tour agency. In the Category Sidebars (tourist destinations) I will have a banner promoting a specific tour.
I think I understand from your questions that I can have a Entire Site Sidebar and Category Sidebars that includes the generic banner plus some specific content. That sounds also interesting to explore.
Thanks,
André
As an option:
There are two additional sidebar hooks - before_right_sidebar_content and after_right_sidebar_content which could be deployed. So if the Entire Sites content could be displayed everywhere - then you could hook in Category specific elements using those hooks.
Unsderstood. That could be handy in some situations, for sure.
For the present situation, I need totally different sidebars for each category, besides the Entire Site custom sidebar. My only option would be to set location and exclusion rules "one by one"? Or is there a simpler way?
Thanks David!
For the sidebar of each category, you just need set its location, don't need to set excluded locations.
For the entire site sidebar, if you have specific sidebars for single posts, then you can try to exclude posts > all posts. Otherwise, I'm afraid you'll have to manually exclude them one by one.
Thank you both. I undestand my options.
I will probably stick with the default WP sidebar for the Entire Site Sidebar and use Elements for categories sidebars.
I will try to recreate in the default WP widgetized sidebar the buttons I need. I need this blue/orange buttons (made with in Elements with GB) https://www.tempodeviajar.com/bali-indonesia-guia-fazer-ver-visitar/
I may need some help inserting the SVG iscons inline with the text, but I will look for a solution here in the support forum and open another ticket if I cant figure it out for myself.
Cheers,
André
No worries, don't hesitate to ask for help :)
Hi again!
Still evaluation options here... :)
One quick question. Does it causes any bloat to have many different Block Sidebars with many location and excusion Rules? Say about 50 sidebars and 100 exlusion rules.
Thanks
It probably won't make any noticeable difference to the performance of the site.... but it sounds like a workflow/maintenance nightmare to upkeep 50 static sidebars.
Might be better to look at dynamically generating the sidebars content as opposed to conditionally displaying static sidebars. Plugins like ACF/Metabox will allow you to add options to your Categories, which could be used to generate the sidebar content...
Thanks David! That sounds a bit advanced for me. I will have a closer look anyway, but I'll probably keep my current system for now.
I have been runing like this for some years (with a plugin for widget sidebars that I'm now replacing with blocks sidebars) and after the first setup is not so work intensive. It´s far from perfect... but I dont change each sidebar content that often.
Cheers,
André
No problems - if it works for you then its all good!