Title: Conditional Content Block
Last modified: August 17, 2022

---

# Conditional Content Block

 *  Resolved [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * (@domainsupport)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/)
 * Hi all,
 * So in re-building this town site with Twenty Twenty-Two we’ve managed to do so
   entirely without a child theme. I don’t like child themes because they quickly
   become out-of-sync with the parent theme which can causes minor inconveniences
   to quite drastic problems. Child themes also have quite an impact on load times.
 * In order to get around the problem of how to display blocks and content programatically
   without having theme files to edit, we’ve created this content by building custom
   plugins that produce shortcodes that can be used with the Shortcode Block. Great.
 * **However**, quite a lot of this is pretty basic conditional stuff like …
 * > Does the current page / post have a featured image? If so show the featured
   > image, if not show another default image.
 * We’ve tried to find a plugin that would allow for conditional content like this
   by adding a “Conditional Content” block but can only find plugins that conditionally
   hide or display the relevant blocks with CSS, not one that shows them programatically.
 * Am I missing something or do I need to develop a plugin to do this? 🙂
 * Oliver
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fconditional-content-block%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/#post-15925994)
 * Hi [@domainsupport](https://wordpress.org/support/users/domainsupport/) – I just
   did a simple test via [@ndiego](https://wordpress.org/support/users/ndiego/)’
   s “Block Visibility — Conditional Visibility Control for the Block Editor” plugin:
 * [https://wordpress.org/plugins/block-visibility/](https://wordpress.org/plugins/block-visibility/)
 * – Went to Appearance > Editor > Page template
    – Toggled **off** the visibility
   on the Post Title block
 * [⌊Editor beta Self hosted Test WordPress⌉⌊Editor beta Self hosted Test WordPress⌉[
 * I then spot-checked several pages on the front end, and I don’t see the Post 
   Title block output anywhere in the code, so it doesn’t look like CSS is being
   used to hide it. I did another test with a different type of block and got the
   same result. I didn’t test anything complex, but you might want to have a look
   and see if it might work for your needs.
 *  Thread Starter [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * (@domainsupport)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/#post-15929187)
 * Thanks Kathryn,
 * I’m not sure how I missed that plugin … however, I’m not seeing how to conditionally
   show content using it on whether a post has a featured image or not.
 * There is a `_thumbnail_id` meta key which is present if a post has a featured
   image … but it looks like testing for metadata is a premium feature of that plugin…
 * > Here’s a look at what’s currently included with Pro:
    - Support for all post and user metadata (custom fields).
 * Oliver
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/#post-15929383)
 * I didn’t dive into looking at that specific example you mentioned with the featured
   image, as it seemed like it was just one example of something you’re trying to
   do.
 * The best person to help guide you is probably Nick, so I’d suggest you post in
   the plugin’s forum to see if he can tell you whether his plugin would allow you
   to do that specific thing, or if not, if he knows of another plugin that might
   already exist to help you achieve it.
 *  Thread Starter [Oliver Campion](https://wordpress.org/support/users/domainsupport/)
 * (@domainsupport)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/#post-15929393)
 * Good plan.
 * Will do, thanks!
 * Oliver
 *  Moderator [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * (@zoonini)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/#post-15929403)
 * You’re very welcome!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Conditional Content Block’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/twentytwentytwo/2.1/screenshot.
   png)
 * Twenty Twenty-Two
 * [Support Threads](https://wordpress.org/support/theme/twentytwentytwo/)
 * [Active Topics](https://wordpress.org/support/theme/twentytwentytwo/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/twentytwentytwo/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/twentytwentytwo/reviews/)

## Tags

 * [block](https://wordpress.org/support/topic-tag/block/)
 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [content](https://wordpress.org/support/topic-tag/content/)

 * 7 replies
 * 2 participants
 * Last reply from: [Kathryn Presner](https://wordpress.org/support/users/zoonini/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/conditional-content-block/#post-15929403)
 * Status: resolved