beaverbuilder
6/10/2018 - 6:27 PM

Add custom attributes to rows, columns or modules

This snippet is used in the following knowledge base article –

<?php // do not copy this line, start with line 3

add_filter('fl_builder_row_attributes', function ( $attrs, $row ) {
    if ( 'my-row-id' == $row->settings->id ) {

        $attrs['data-foo'] = 'bar';
        $attrs['data-foo-2'] = 'bar-2';

    }
    return $attrs;
}, 10, 2);
<?php // do not copy this line, start with line 3

add_filter('fl_builder_row_attributes', function ($attrs, $row) {
    if ('my-module-id' == $row->settings->id) {
        
        $attrs['data-foo'] = 'bar';
    }
    return $attrs;
  }, 10, 2);
<?php // do not copy this line, start with line 3

add_filter('fl_builder_column_attributes', function ($attrs, $row) {
    if ('my-column-id' == $row->settings->id) {
        
        $attrs['data-foo'] = 'bar';
    }
    return $attrs;
  }, 10, 2);
<?php // do not copy this line, start with line 3

add_filter('fl_builder_row_attributes', function ($attrs, $row) {
    if ('my-row-id' == $row->settings->id) {
        
        $attrs['data-foo'] = 'bar';
    }
    return $attrs;
  }, 10, 2);