Archived topic
header/layout control for client
3 replies · Started by Jean on August 27, 2020
My client wants most of their site to use a transparent header, but many posts they'll be creating will need a "regular" / non-transparent header. I'm trying to avoid having to instruct them to go into GP Elements to manually exclude posts in my "Transparent Header" element. The best way I can think of is to create a special category ("Standard Header", for example) and exclude that category -- they they'd just have to tick that box when creating a post where they don't want a transparent header. But then I still have to deal with hiding that category from meta info, search queries, etc. Is there a better way I'm not thinking of? Thanks!
Hi there,
good timing, just working on something to help with this specific need :)
Add this PHP Snippet to your site:
// Generate custom taxonomy for Element Display Rules
function element_control_custom_tax() {
register_taxonomy(
'element-controls',
array( 'post', 'page' ),
array(
'label' => __( 'Element Controls' ),
'rewrite' => array( 'slug' => 'element-controls' ),
'hierarchical' => true,
'show_in_rest' => true,
)
);
}
add_action( 'init', 'element_control_custom_tax' );
https://docs.generatepress.com/article/adding-php/
This will add a new Element Controls taxonomy to Posts and Pages.
Simply add a new term ( like you would if it were categories ). e.g Remove Transparent Hero
You will then find a Post Element Control > Remove Transparent Hero in Elements Display Rule Locations. You can simple Exclude that from your display rules.
!@#$ing awesome -- thanks so much!!
:) Glad to be of help