By Stephen Walker

In version 7.3 the ThemeFusion team added conditional rendering to the Avada toolset, but what they didn’t do is explain all of the possible use cases. The initial focus in on Woo-commerce, user roles, and as a replacement for the visibility settings on device types. Even their overview only gives you a basic glimpse into the power. In a couple of projects at work I have discovered how powerful they can be especially combined with custom fields and dynamic data. The one drawback is that it is limited to columns — standard and nested — and containers, but nested columns are really the key at this point.

Rendering based on an empty value

Scenario 1 : Subtitle

The first time I ran across an undocumented feature is when I was working on a blog layout. In this design I have the excerpt text displayed below the title of a post, but I also have a custom field for a subtitle. The latter is seldom used, but when it is I don’t want both the subtitle and the excerpt to show. I was thinking, it would be really nice if the dynamic element allowed me to have a fallback of the excerpt. While this may be possible since the before and after fields can use Avada shortcodes, I haven’t tested it in the fallback. As I looked at the screen I started thinking about conditional rendering and would it be possible to have an if-then condition — if the subtile is null, show the excerpt. What I found is that you can do just that — if the custom field “subtitle” is empty. Since the dynamic data for the subtitle has a fallback of nothing, it is not displayed by default. I built a custom title bar and placed each element into its own nested column.

The steps

Fortunately, this is really simple to build.

screenshot of the conditional rendering interface
  1. Open the conditional rendering logic options and choose custom field
  2. Add the custom field ID
  3. Leave the value field blank

Scenario 2: Special Label

The scenario and setup is essentially the same as the previous with only one small variation. In this case we need to display that an official biography is only available for historic purposes and that the person is no longer part of the organization. I have a set of custom fields for a biography that include a start year and an end year. While the person is with the company, the end year is blank and has a fallback of “present.” When the individual departs, the departure year is added. In this scenario the condition is set to render when the custom field “departure_year” is not equal to blank. I could have added a checkbox field with a set value, but this minimizes the need to update two field when a person departs.

Title bar showing added label

This is just the beginning of my exploration of the conditional rendering logic and I expect in the near future that these features will be expanded to allow even more options.

Originally published on June 24, 2022

share the article

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

RELATED ARTICLES

  • ThemeFusion announces price increase

    Avada’s price on Themeforest will increase to $69 on the 1st of July, 2022

  • Avada for the win – again

    In my apparently relentless pursuit of finding an alternative for Avada, I once again made my way around the builderverse and once again I am back to Avada.