Archived topic
General use question about organizing layouts for a large site
3 replies · Started by Eric on July 20, 2022
I'm looking for a little direction or advice about our particular use of GP.
We have a large site with a couple thousand posts and almost as many pages, some separated into a couple different post types.
We only need a few Content Template Elements to do what we need.
The problem is, these Content Templates need to be targeted to the appropriate pages, and it seems like the expected way to do that is through an enormous list of Locations and Exclusions. When you have a thousand+ pages, that's a lot to manage in one spot, hoping you don't create overlap by mistake.
I'm open to creating WordPress Custom Page Templates in our child theme so that the layout can be determined by the the Page itself instead of centrally under Appearance > Elements.
How update-proof is the following approach?
https://generatepress.com/forums/topic/creating-a-custom-page-template/#post-1875566
Or maybe someone with more GP experience has a better solution that I've overlooked?
I have one request for the Location/Exclusion settings for Elements that I hope could be considered for the future. I'd love to see more flexible options similar to how ACF handles their Location Rules.
Hi Eric,
In your case, I believe it may be more ideal to just use the generate_element_display filter instead of creating an actual template like the one in the link you provided: https://docs.generatepress.com/article/generate_element_display/
Through this, you can create an array of the posts you want to exclude or include in your Element, and then apply it to your conditional statement.
This also bypasses the actual display rules so you wouldn’t have to select it manually. You can just leave it blank, and let the code set the display rules.
Hope this clarifies.
Thank you for the recommendation, this is perfect!
You’re welcome Eric!