1. <?php
  2.  
  3. function custom_remove_container_width( $fields ) {
  4. foreach ( (array) $fields['style'] as $index => $rule ) {
  5. if ( preg_match( '/^width:/', $rule ) )
  6. unset( $fields['style'][$index] );
  7. }
  8.  
  9. return $fields;
  10. }
  11. add_filter( 'builder_filter_container_outer_wrapper_attributes', 'custom_remove_container_width', 20 );
  12.  
  13. function custom_remove_module_width( $fields ) {
  14. /* add module specific rules here */
  15.  
  16. foreach ( (array) $fields['attributes']['style'] as $index => $rule ) {
  17. if ( preg_match( '/^width:/', $rule ) )
  18. unset( $fields['attributes']['style'][$index] );
  19. }
  20.  
  21. return $fields;
  22. }
  23. add_filter( 'builder_module_filter_outer_wrapper_attributes', 'custom_remove_module_width', 20 );
  24.  
  25. function custom_add_open_module_wrapper( $fields ) {
  26. $width = apply_filters( 'builder_get_container_width', 0 );
  27.  
  28. echo "<div class='builder-module-limit-width-wrapper clearfix' style='width:{$width}px;margin:0 auto;'>\n";
  29. }
  30. function custom_add_close_module_wrapper( $fields ) {
  31. echo "</div>\n";
  32. }
  33. add_action( 'builder_module_render_contents', 'custom_add_open_module_wrapper', 0 );
  34. add_action( 'builder_module_render_contents', 'custom_add_close_module_wrapper', 20 );
  35.  
  36. ?>
  37.