Conditional logic

Learn how to show different content on one WEMASY page with the Conditional element, using URL hashes such as tabs or plan switches.

The Conditional element shows different content in the same spot, depending on the URL hash, the part of the address after the # sign. Use it for tabs, a monthly or yearly price switch, or content that changes when a visitor clicks a button. Only one item is visible at a time.

How it works

Website Builder: Conditional logic

Each item of the element has a rule in the form #type=value, for example #plan=yearly. When the address of the page ends with that hash, the item shows. A button or link that points to #plan=yearly switches the content without loading a new page.

Add the element

  1. Click Elements in the left sidebar.
  2. Drag Conditional into a section.
  3. Open the element settings.
  4. Click Add Item for each version of the content.
  5. For each item, fill in Show When #type=value, for example #plan=monthly and #plan=yearly.
  6. Switch on Default Active if No Active #type=value for the item that shows when the address has no hash.
  7. Click Save.

Design each item

After saving, design each item's content in the editor using the numbered tabs on the element. Drag elements into each tab as in any section.

Add the switch buttons

  1. Add a Button for each option.
  2. Set the Button URL to the hash, for example #plan=monthly.
  3. Optionally switch on Default Active on the button of the default item, so it looks selected when the page loads.

Hide content with a hash

You can also use Hide When #type=value on an item. And any section can be hidden with Hide When URL Hash Matches in its visibility settings. See Section animations and visibility.

Tip: use a clear, short type, such as plan, tab or view, and the same type for all items of one element. If the element shows No conditions added yet, click the eye icon to add them.

Put it to work
on your own website.

Start free with WEMASY and build your site in a few minutes.