Add style attribute in header
-
Hi there,
I would like to add an attribute (style) to the header. I have tried with this filter ‘generate_after_element_class_attribute’ with no success.add_filter( 'generate_after_element_class_attribute', function( $after, $context ) { if ( 'site-header' === $context && !is_front_page() ) { $after = 'style="height: 65vh;"'; } return $after; }, 10, 2 );
I don’t want to add css in customizer, because as you see, I need to add this style attribute only in some pages. I have done it with Javascript, but I would prefer with generatepress hooks.
What am I doing wrong? Is there any filter to solve this?
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add style attribute in header’ is closed to new replies.