• Hi,

    I would like to add an attribute ‘data-bg’ to elements that contain background-images, such as columns. For this I edit bt_bb_column.php as such

    		
    $output = '<div ' . $id_attr . ' class="' . implode( ' ', $class ) . '" ' . $style_attr . ' data-width="' . $width . '" data-bg="' . $background_image_url . '">';
    

    I would expect this to work but it didn’t.Could you kindly point me to the right direction on how to accomplish that?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author boldthemes

    (@boldthemes)

    Hi @stemon,

    Please try replacing the code from 106-121 line in bt_bb_column.php file with the following:

    $data = '';
    if ( $background_image != '' ) {
    	$background_image = wp_get_attachment_image_src( $background_image, 'full' );
    	$background_image_url = $background_image[0];
    	$el_style .= 'background-image:url(\'' . $background_image_url . '\');';
    	$data .= '' . $background_image_url . '';
    	$class[] = 'bt_bb_column_background_image';
    }
    
    $style_attr = '';
    
    if ( $el_style != '' ) {
    	$style_attr = 'style="' . esc_attr( $el_style ) . '"';
    }
    
    $data_arr = '';
    
    if ( $data != '' ) {
    	$data_arr = 'data-bg="' . esc_attr( $data ) . '"';
    }
    
    $class = apply_filters( $this->shortcode . '_class', $class, $atts );
    
    $output = '<div ' . $id_attr . ' class="' . implode( ' ', $class ) . '" ' . $style_attr . ' ' . $data_arr . ' data-width="' . esc_attr( $width ) . '">';
    

    Please let us know if the changes work properly. Thanks!

    Thread Starter Stefano Monteiro

    (@stemon)

    Hi, thanks for quick response and code snippet. Unfortunately, it didn’t work. Though no matter what I change in the $output variable nothing happens. I cleaned all cache and deactivated plugins, cloudflare etc. And nothing. I have also added the snippet to bt_bb_column_inner.php.

    Plugin Author boldthemes

    (@boldthemes)

    Hi @stemon,

    Thanks for the info.

    Since you are using our premium theme, please make sure to contact our support team for more detailed info. Thanks!

    Thread Starter Stefano Monteiro

    (@stemon)

    It seems that my support has expired. If you want to pass it on to them. I have just tried on a fresh install locally and the same happens.

    Plugin Author boldthemes

    (@boldthemes)

    Hi @stemon,

    Kids Club, our premium theme, used Rapid Composer which was replaced with Bold Builder plugin, so custom changes should be made differently than standard (previously written) method.

    Unfortunately we can not provide you support on www.ads-software.com for our premium themes. If you would like you can write us on: [email protected].

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add attribute to background-image elements’ is closed to new replies.