Summer Sale: Save 20% on any WS Form edition CODE: SUMMER20 View Pricing

Conditionally Show Content in Your Forms in WordPress

Use #if and #endif to conditionally include content across your forms, actions, and mappings.

  • Conditional content output Include content only when an expression evaluates to true.
  • Use across actions Apply conditions in Send Email and Show Message actions.
  • Works in form logic Use #if(…) conditions in conditional logic on your form.
  • Field value comparisons Compare field values, strings, or other WS Form variables.
  • Multiple condition support Combine conditions with AND and OR operators.
  • Flexible operator set Use equals, contains, starts with, ends with, and more.

Use #if and #endif to conditionally include content in WS Form. In forms in WordPress, this lets you show or hide content when an expression evaluates to true or false.

These variables can be used in a variety of locations, including the Send Email action, Show Message action, conditional logic, and field mappings to external APIs.

You can compare values with operators such as equals, does not equal, less than, greater than, contains, starts with, and ends with. You can also combine multiple conditions with && and ||.

  • Show or hide content

    WS Form outputs content when a condition is true and ignores it when false.

  • Simple syntax

    The basic structure is #if(expression) content #endif.

  • Check for blank values

    Without an operator, WS Form checks whether the input is not blank.

  • Compare different values

    Compared values can be a string or another valid WS Form variable.

  • Use logical operators

    Separate multiple conditions with && for AND or || for OR.

  • Support dynamic messages

    Use conditional content in messages and email output.

  • Map conditionally to APIs

    Use #if and #endif in field mappings to external APIs.

  • React to value changes

    Conditional logic can reassess #if(…) conditions when a compared value changes.

Real Customer Reviews

Trusted by thousands of WordPress professionals.

  • This form software will literally do just about anything you might ever want an online form to do. It comes with a supreme level of technical support.

    ibowden
  • Mark and his team are tremendous! Always going above and beyond. Great product and even greater support.

    pt2330
  • WS Form is now part of every website build at the company I work for. If you need more than a simple form, this is the best plugin to use in my opinion.

    originalperceptions

Frequently Asked Questions

What do #if and #endif do in WS Form?

They are used to conditionally include content. If the expression evaluates to true, WS Form outputs the content. If it evaluates to false, WS Form ignores it.

Where can I use #if and #endif?

They can be used in locations such as the Send Email action, Show Message action, conditional logic, and field mappings to external APIs.

How do I use #if and #endif in WS Form?

Use the basic syntax: #if(expression) content #endif. The expression is evaluated to its boolean value, and the parts of the expression must be separated by spaces. You can learn more here: If … Endif.

What happens if I do not specify an operator?

WS Form checks that the input is not blank. If it is blank, the expression returns false. If it is not blank, the expression returns true.

Can I use multiple conditions in one #if statement?

Yes. You can use multiple conditions separated by && (AND) or || (OR).

What operators are available in #if statements?

Available operators include equals, does not equal, less than, greater than, less than or equal to, greater than or equal to, contains, does not contain, starts with, does not start with, ends with, and does not end with.