Update 1.4.4 question


What do you exactly mean with “Added filters for working with custom css classes on rows, columns and modules” in the latest 1.4.4 bb plugin update? I’m just curious about this update because i sounds interesting! Could you give us a small example?

Thanks in advance!

Hi Jorrit,

Sorry, I haven’t documented that filter yet (I’m behind on documentation). Those filters lets you work with the custom classes that can be applied for rows, columns and modules on the advanced tab.

The use case that we added them for is theme developers that wish to remove a custom class from a node’s wrapper div and apply it to another element within frontend.php.

The filters are…


They can be used like so…

function my_custom_module_class_filter( $class, $module ) {
     return ''; // return an empty string to remove the class. 

add_filter( 'fl_builder_module_custom_class', 'my_custom_module_class_filter', 10, 2 );

The module’s class can then be accessed in frontend.php like so…

<div class="my-element <?php echo $module->settings->class; ?>"></div>

Let me know if you have any questions.



I think it would be really cool if you could use this filter to update a module’s class via a select box - that way you could have a couple of classes - half and full for example - that the user could choose from without having to type the class (and possibly make a typo). The idea would be you could add this to your custom settings and then populate the custom class from the dropdown.

Something like

public function my_custom_module_class_filter($class, $module) {
    $class = '';
    if(!empty($this->settings->module_width)) {
        if($this->settings->module_width === 'half') {
          $class = 'col-sm-6';
    return $class;
add_filter( 'fl_builder_module_custom_class', 'my_custom_module_class_filter');

And then of course you would have module_width as a select in your settings.

This doesn’t seem to work for me, but it seems like it should.


Hi DiAnne,

Those filters don’t modify the saved value, only the class that gets rendered in the markup.

However, another user did submit a pull request adding the ability to add a “predefined” values select to text fields. We’ve yet to document that, but used in conjunction with the fl_builder_register_settings_form filter, you can do what you’re looking to do.

Have a look at the following code and let me know if you have any questions.

function my_builder_register_settings_form( $form, $id ) {
	if ( 'module_advanced' == $id ) {
		$form['sections']['css_selectors']['fields']['class']['options'] = array(
			'value-1' => 'Label 1',
			'value-2' => 'Label 2',
			'value-3' => 'Label 3'
	return $form;

add_filter( 'fl_builder_register_settings_form', 'my_builder_register_settings_form', 10, 2 );