- This topic has 9 replies, 3 voices, and was last updated 5 months, 1 week ago by Leo.
March 10, 2022 at 11:42 pm #2150375Brent Wilson
Is there a way to set one element to display on the entire site, but then have other elements that are meant to take the place of that entire site element on certain pages or posts?
Element A – display rule: entire site
Element B – display rule: specific page
For Element B to replace Element A on a specific page, do I need to both include that specific page in the display rules for Element B, AND ALSO exclude that specific page in the display rules for Element A?
Or is there a way (maybe through priority or something?) to just have Element B automatically replace Element A on that specific page just by setting the display rule for Element B to that page?March 11, 2022 at 12:28 am #2150421Fernando Customer Support
For this, the safest route would be to set Exclude rules in the Display Rules settings.
However, if you’re referring to the style we were adding through a Hook Element in the previous conversation, adding a higher priority would overwrite the lower priority in terms of CSS.
In other cases though, as mentioned, setting Exclude rules would be most ideal to make an Element not appear in certain pages.
Hope this clarifies. 🙂March 11, 2022 at 11:03 am #2151167Brent Wilson
So basically, if I have two competing elements, I need to add it to a page/post in one element and exclude it from that page/post in the other element? So basically each time I add an additional page, I would need to go into both elements and add the page in one and exclude the page in the other?
What I would like would be to just set one element to the entire site, and then only have to add pages/posts to the other element and have it override the site-wide element on those specific pages/posts. Is this not how elements work?March 11, 2022 at 11:18 am #2151187LeoStaffCustomer SupportMarch 11, 2022 at 11:22 am #2151190Brent Wilson
It could be a decorative sidebar in a different color that I want to apply to multiple pages and certain post taxonomy terms. Or a different footer that I want to apply to certain post taxonomy terms and various individual pages. Etc.
So say I want the site-wide default footer to be built with a block element with a red background. But then I want a block element footer with a blue background applied to certain pages and post taxonomy terms. So do I need to edit both the red footer (exclude a list of pages and terms) and the blue footer (apply to the list of pages and terms)? Or is there a way to only have to edit one of the elements instead of both when I want to apply the blue footer to additional pages and terms?March 11, 2022 at 11:26 am #2151191LeoStaffCustomer Support
Sounds like the display rule is the best solution here.
Or you can consider using this filter for more complicated display rules:
https://docs.generatepress.com/article/generate_element_display/March 11, 2022 at 11:33 am #2151195Brent Wilson
But am I understanding the display rules correctly in that one element needs to have exclusions added, while the other element needs to have display locations added? So with display rules, I am going to need to edit two different elements and the display rules on one element can’t simply override the site-wide element?March 11, 2022 at 11:49 am #2151221LeoStaffCustomer SupportMarch 11, 2022 at 11:58 am #2151229Brent Wilson
Okay. Thanks!March 11, 2022 at 12:16 pm #2151255
- You must be logged in to reply to this topic.