Site logo

Archived topic

Want to add a data-src tag to hero div

1 reply · Started by madmanweb on May 26, 2019

Viewing posts 1–2 of 2

Hi there,

Give this a shot:

add_filter( 'generate_page_hero_output', function( $output, $options ) {
    return sprintf(
        '<div class="%1$s" data-src="/images/background.jpg">
            <div class="%2$s">
                %3$s
            </div>
        </div>',
        trim( $options['container_classes'] ),
        trim( $options['inner_container_classes'] ),
        $options['content']
    );
}, 10, 2 );

You'll of course need to update the path to the background image in the data-src attribute.

Let me know if you need more info :)

This archived topic is closed to new replies.