30th Jun '23
/
8 comments

Featured Image Fallback in Bricks

This Pro tutorial shows bricks/element/settings filter of Bricks builder can be used to specify the ID of an image in the WordPress Media Library that should be shown for posts that do not have a featured image set in a query loop.

Note that it is also possible alternatively to simply add another Image element (besides the one for featured image) and use conditions to output one of them depending on whether each post has a featured image or not.

Add the following in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Automatically Adding Classes to Elements in Bricks

Automatically Adding Classes to Elements in Bricks

In the Bricks Facebook group a user asks: Default classes for theme style elements? Is it possible to assign default classes to elements in the…