Posted in: Bricks Builder Tutorials

Posted on:

How to Exclude Posts Without Featured Images in Bricks Builder

When you have a loop displaying posts, some posts might not have a featured image, making your design look incomplete.

For example, you might have a series of posts in which the first three feature images, but the fourth one does not. This inconsistency can be visually unappealing.

Step 2: Open Bricks Builder

Navigate to your post loop inside Bricks Builder. Identify the loop that is displaying your posts. In this example, the loop uses cards to display each post.

Step 3: Access the Query Loop

Open the query loop settings. Here, you will find an option to add a meta query. This is where we will set up our condition to check for the existence of a featured image.

Step 4: Add a Meta Query

  1. Meta Key: Use the meta key _thumbnail_id to check for the featured image.
  2. Meta Value: Leave this field blank.
  3. Compare: Set this to EXISTS. This tells the query to include only posts that have a _thumbnail_id.

Step 5: Apply the Meta Query

Once you add the meta query, any post without a featured image will be excluded from the loop. Save your changes and refresh your test page to see the results. The posts without featured images should no longer be visible.

Step 6: Verify the Changes

To confirm the meta query is working, edit one of your posts to remove its featured image. Save the changes and refresh your test page. The post is now excluded from the loop.

Additional Resources

For more information about meta keys, refer to this Stack Overflow article. This resource lists common meta keys, such as thumbnail_id, and other valuable keys, like the last edited page template and user meta keys (e.g., first name, last name, nickname).

Conclusion

Using a meta key query in Bricks Builder is a simple and effective way to ensure that your post loops only display posts with featured images. This technique helps maintain your website’s visual integrity.

You may also like these posts.

Join The Community

Join over 14,000 WordPress enthusiasts and become part of a vibrant community.