ceescoenen

Bricks Filter

Aug 10th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. add_filter( 'bricks/element/render', function( $render, $element ) {
  2.   // Get the element CSS classes
  3.   $classes = ! empty( $element->attributes['_root']['class'] ) ? $element->attributes['_root']['class'] : false;
  4.  
  5.   // Check if the element has the special class "hide-for-subscribers"
  6.   if ( $classes && in_array( 'cc--hide-gallery', $classes ) ) {
  7.      
  8.      $value = rwmb_meta( 'ig_switch' );
  9. if ( $value ) {
  10.     $showgal = true ;
  11. } else {
  12.      $showgal = false ;
  13. }        
  14.      
  15.      
  16.     return $showgal;
  17.   }
  18.  
  19.   return $render;
  20. }, 10, 2 );
  21.  
Advertisement
Add Comment
Please, Sign In to add comment