Welcome, Guest Login

Support Center

Our documentation is moving:

Please check for the most up-to-date LiveWhale CMS and LiveWhale Calendar documentation. The below legacy documentation will remain available as a reference until the documentation migration is complete.

Using conditions in widget format

Last Updated: Sep 02, 2016 10:20AM PDT
It's possible to use conditions in widget formatting to display fields based on an IF-statement.

  • Here you can use pipes to show a header ONLY when a profile field (ex., profile field #80) exists.
  {<h5>This header will only show on certain profiles</h5><p>|profiles_80|</p>}
  • Below demonstrates through the widget editor, displaying a label (ie., Major), if content exists in the field, profiles_89. 

Real-life Example

‚ÄčI don't know how to code a profiles widget to show more than one profile type and pull either of the profile type's if they exist into my results. I want to add the Beneficiaries type and it's profile field, profiles_296.
<widget id="123_profiles_widget">
      <arg id="type">Donors</arg>
      <arg id="filter" name="profiles_294" action="has"></arg>
      <arg id="format">
          {image}<div class="text"><blockquote>{profiles_294}</blockquote>
          <a href="{href}" class="attribution">{name_clean} </a> </div>


First, profile types may/may not have the same profile fields. In the logic above, you reference profiles_294 in the format argument. The Beneficiaries profile type would need to have this field in order to populate the content, so we need to add a condition to display it's profile data from profiles_296.

Second, we need to broaden the filter to check if content exists in either the profiles_294 or profiles_296 fields using the filter_mode argument to gather profiles that meet this criteria.

Third, we need to write logic into the format argument to display content based on the profile type and it's corresponding profile field.

Here's the resulting widget:

<widget id="123_profiles_widget">
       <arg id="type">Donors</arg>
       <arg id="type">Beneficiaries</arg>
       <arg id="filter" name="profiles_294" action="has"></arg>
       <arg id="filter" name="profiles_296" action="has"></arg>
       <arg id="filter_mode">any</arg>
       <arg id="format">
         <div class="text">
             <a href="{href}" class="attribution">{name_clean} </a>
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found