How to highlight an entry from a specific date

You can use [gvlogic] shortcode to compare dates

In the example below, we highlight today's entries by comparing the date stored on the field "Date B" with today's date (using the Gravity Forms Merge Tag {date_dmy}).

Let's start by adding a Custom Content field to our View:

Entries Fields settings showing columns: Single Line Text A, Date B, and gvlogic with icons

We click the cog icon to configure the contents of the field, then add the following code:

[gvlogic if="{Date B:3:dmy}" is="{date_dmy}"]
	<span style="background-color: green; color: white; padding: 2px 5px;">
		It’s Today
	</span>
[/gvlogic]

The code uses the [gvlogic] shortcode to check whether the date of the "Date B" field is the same as today's date. If so, the code will output HTML that shows the words "It's Today" with a green background.

Here's how the Custom Content field appears, when configured:

Code example showing how to highlight text if the current date matches a specific date in the documentation

And this screenshot shows how the Custom Content field appears in the View:

Three dates listed; "Today" line highlighted with "It's Today" for September 22, 2022

You can read more about the [gvlogic] shortcode and everything possible to achieve here: Using the [gvlogic] shortcode.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us