- This topic has 9 replies, 3 voices, and was last updated 5 months, 1 week ago by
Leo.
-
AuthorPosts
-
March 10, 2022 at 11:42 pm #2150375
Brent 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?
So:
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
Hi Brent,
For this, the safest route would be to set Exclude rules in the Display Rules settings.
See: https://share.getcloudapp.com/JruONn66
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.
See: https://share.getcloudapp.com/12ug6PNZ
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 #2151187Leo
StaffCustomer SupportWhat would the content of Element B be?
Could you just add the content of that element directly into the page if it’s only used for that page?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 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 #2151191Leo
StaffCustomer SupportSounds 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/Examples here: https://generatepress.com/forums/search/generate_element_display/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/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 #2151221Leo
StaffCustomer SupportThat’s basically correct.
The elements themselves don’t have priority there is really no “overwriting” in them.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 11, 2022 at 11:58 am #2151229Brent Wilson
Okay. Thanks!
March 11, 2022 at 12:16 pm #2151255Leo
StaffCustomer SupportNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.