Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // show element header-home__container when it is the homepage
- add_filter( 'bricks/element/render', function( $render, $element ) {
- // Get the element CSS classes
- $classes = ! empty( $element->attributes['_root']['class'] ) ? $element->attributes['_root']['class'] : false;
- // Check if the element has the special class "hide-for-subscribers"
- if ( $classes && in_array( 'header-home__container', $classes ) ) {
- return is_front_page();
- }
- return $render;
- }, 10, 2 );
- // show element header-page__container when it is not the homepage
- add_filter( 'bricks/element/render', function( $render, $element ) {
- // Get the element CSS classes
- $classes = ! empty( $element->attributes['_root']['class'] ) ? $element->attributes['_root']['class'] : false;
- $front_page = ! is_front_page();
- // Check if the element has the special class "hide-for-subscribers"
- if ( $classes && in_array( 'header-page__container', $classes ) ) {
- return $front_page;
- }
- return $render;
- }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment