When to use Advanced Filter vs Field Conditional Logic vs gvlogic
Advanced Filter, Field Conditional Logic, and the [gvlogic] shortcode all act on conditions. Advanced Filter decides which entries a View lists, and Field Conditional Logic decides whether a field shows for each entry. The [gvlogic] shortcode decides what appears inside a field or on a page.
Advanced Filter and Field Conditional Logic come with Advanced Filtering, which is built into GravityView Pro. To turn it on or off, go to Plugins and click Features in the GravityView Pro row.
This video shows all three on one View.
Which one to use #
| To do this | Use | Doc |
|---|---|---|
| List only the entries that match a value, a status, or a date | Advanced Filter | Getting started with Advanced Filtering |
| Show each signed-in user only the entries they created | Advanced Filter | How to show only entries created by the currently logged-in user |
| List only the entries created by users with a certain role | Advanced Filter | Showing only entries created by users with a certain role |
| Show different entries to each user role | Advanced Filter | Showing different entries to each user role |
| Show or hide one field, based on another value in the entry | Field Conditional Logic | Field Conditional Logic |
| Show a message where a field would be empty | Field Conditional Logic | Field Conditional Logic |
| Show a field to one exact role | Field Conditional Logic | Using the [gvlogic] shortcode |
| Show different text or HTML for each value of a field | [gvlogic] | Using the [gvlogic] shortcode |
| Show one thing to signed-in users and another to visitors | [gvlogic] | Using the [gvlogic] shortcode |
| Show content on a page outside a View | [gvlogic] | Using [gvlogic] to show or hide content anywhere on your site |
How they compare #
| Advanced Filter | Field Conditional Logic | [gvlogic] | |
|---|---|---|---|
| Where you set it | The View's Filter & Sort tab | The field's settings | A Custom Content field, or a page |
| Shown when nothing matches | The View's no-entries message | Nothing, or your Empty Field Content | Nothing, or your [else] content |
| Can check the viewer's role | Yes | Yes | No |
| Works on a page outside a View | No | No | Yes |
Advanced Filter #
Use Advanced Filter to choose which entries belong in a View. Entries that don't match are left out of the View and its search results, and opening one at its own address shows "You are not allowed to view this content."
- Edit the View.
- In the Settings box, open the Filter & Sort tab.
- Scroll to Advanced Filter and click Add Condition.
- Choose a field, an operator, and a value.
- To add another condition, click + Condition. Then click AND if every condition has to match, or OR if any one can.
- Click Update.
To mix AND with OR, click + AND at the bottom of the panel to add a second group. Showing different entries to each user role has a worked example, and Getting started with Advanced Filtering covers the rest of the setting.
This filter lists open service requests from the last 30 days. For the date, choose Custom Value in the last box and type -30 days. Using relative Start Dates and End Dates explains this format.

Field Conditional Logic #
Field Conditional Logic checks each entry on its own. The entry stays in the View whether or not the field shows, and a Table View keeps the column with an empty cell. A hidden value isn't sent to the browser.
- In the View editor, click the gear icon on the field.
- Under Visibility, click Add Condition in the Conditional Logic section.
- Choose a field, an operator, and a value.
- In Empty Field Content, enter what to show when the conditions aren't met, or leave it blank to show nothing. It can hold HTML, merge tags, and shortcodes.
- Click Close, then click Update.
To show Unassigned when nobody is assigned, give the Assigned To field the condition Assigned To is not empty, and type Unassigned in Empty Field Content:

Field Conditional Logic works on the real field, so a Table View with Enable sorting by column turned on can still sort by it. A Custom Content field has no sort link.
Field Conditional Logic covers combining conditions. To leave whole entries out of the View, see Field Conditional Logic doesn't hide entries.
The [gvlogic] shortcode #
The [gvlogic] shortcode goes in a Custom Content field or directly on a page, and it can print different text or HTML for each case. This one colors a priority label. Here [else if] handles the second value and [else] handles the rest:
[gvlogic if="{Priority:3}" is="High"]
<span style="color: #b32d2e; font-weight: bold;">High</span>
[else if="{Priority:3}" is="Medium"]
<span style="color: #b26200;">Medium</span>
[else]
<span style="color: #2e7d32;">Low</span>
[/gvlogic]This one marks a date that has passed:
[gvlogic if="{Due Date:5:mdy}" less_than="{date_mdy}"]
<span style="color: #b32d2e;">Overdue</span>
[else]
{Due Date:5}
[/gvlogic]Use the merge tags of your own fields in place of {Priority:3} and {Due Date:5}. For every comparison you can make, see Using the [gvlogic] shortcode. To check two different fields, put a [gvlogic2] inside the [gvlogic], as Using [gvlogic] and [gvlogic2] to create "AND" logic shows.
On a page there's no entry to read, so compare a value that doesn't come from a form, such as {user:ID} or {get:code}. Using [gvlogic] to show or hide content anywhere on your site lists the merge tags that work there.
The shortcode has no parameter for the role of the person viewing the page. The section "Checking a user's role" in Using the [gvlogic] shortcode covers the options.
Using them together #
The three work at different levels, so one View can use them all. This View uses Advanced Filter to list open requests from the last 30 days, Field Conditional Logic to show Unassigned when nobody is assigned, and [gvlogic] to color the priority and mark overdue dates.
