Toolbox for Beaver Builder


Sets the default classes for the ACF image field when adding it with an img- tag.

The classes can be added using the filter, or by adding a filter that enables an attribute to pass in the classes.


  • $classes (array)
  • $attr (string)


If the classes defining the image aren't enough for you you can always add more. This example adds a  new attribute and function so that you can add classes using the [toolbox] shortcode.


add_filter( 'toolbox/helpers/sc_attr/type=image' , 'add_image_class_attr' , 10 ,1 );

// add a custom attribute named 'myclass'
function add_image_class_attr( $attr ) {
	$attr['myclass'] = '';
	return $attr;

add_filter( 'toolbox/helpers/set_acfimage_classes' , 'enable_custom_image_classes', 10, 2 );

// add the custom atrtibute 'myclass' to the $classes array
function enable_custom_image_classes( $classes , $attr ) {

	if (isset($attr['myclass']) && $attr['myclass'] !='' ) {
		array_push( $classes , $attr['myclass'] );

	return $classes;

You can now add classes with extra classes using the shortcode:

[toolbox field='imagefield' tag='true' size='thumbnail' myclass='mycustomclass']


[ error handling twig template ] Template "beaverplugins_samesection.twig" is not defined in "__string_template__2c572f4a6f2901ac0bdd601f3aa8ca34dc8cd00c4b4729bae566e614f285eecd" at line 1.
Last modified: July 1st, 2019