Using [gvlogic] and [gvlogic2] to create "AND" logic

Showing or Hiding Content Based on Two Conditions

By default, the [gvlogic] shortcode accepts one parameter. But what if you want to check two conditions at once?

You can do that by adding a second shortcode, [gvlogic2 and nesting it within the [gvlogic] shortcode. Here's how:

Register the [gvlogic2] Shortcode

Add the following code to your theme's functions.php file:

If you're not sure where to place the code, please refer to this article: Where to put code samples

Create Your Conditional Statement

Now we can nest [gvlogic2] inside [gvlogic] to create an AND statement. The basic structure will look like this:



Here we use [gvlogic] and [gvlogic2]to display a message if both conditions are met:

[gvlogic if="{Address (City):8.3}" is="Boston"]
  You pahk your cah in Hahvad Yahd
  [gvlogic2 if="{Address (ZIP / Postal Code):8.5}" is="02108"]
    and you live in the Beacon Hill neighborhood.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.