Global 'Show Title' for images or default 'On'

Hi,

I’ve just discovered that the site I’m developing has no image titles on any image on the frontend, despite including them in the wp media library when uploading. To fix this I have to open the builder on every page and template and switch ‘Show Title’ on for each image.

It would be handy to either - have the ‘Show Title’ toggle to default to ‘on’ or a global toggle to switch all on or off. I’m not sure why the default is ‘off’? I imagine in most cases image titles are desirable for SEO?

Thanks :slight_smile:

2 Likes

This was changed just recently (in version 1.6.2) on user request I think. See Changelog – Bricks.

If you want the title to be output by default you could use the bricks/element/settings hook:

add_filter( 'bricks/element/settings', function( $settings, $element ) {
    if ( $element->name === 'image' ) {
        $settings['showTitle'] = true;
    }
    
    return $settings;
}, 10, 2 );

See Filter: bricks/element/settings – Bricks Academy.

3 Likes

Hi @aslotta thanks for your reply. I believe the issue that was resolved in 1.6.2 was that the image titles were permanently on. Now they are default off with an option to switch on in each case, but no global on/off option.

Does the filter that you’ve provided affect already created elements or only ones created in the future (after the code has been implemented)?

The filter works dynamically. So it should work for all elements (including the ones that were created before the filter was added).

1 Like