Showing Entries that are about to expire
There are occasions when you want to add a visual indicator to your View results to bring attention to an entry where an action is needed or it's expiration time is due soon.
Here's how to achieve that using the [gvlogic] shortcode, the :timestamp Merge Tag Modifier and a custom Merge Tag created specifically to display the current date/time using the Unix time format. All of that will be done inside a Custom Content field.
On this tutorial, we will use a very simple form containing just two fields: a Description field which is a Single Line Text and a Due Date which is a Date type field.
This is how our initial View looks like:
Let's start by adding this code to our theme's functions.php file in order to have access to a new custom Merge Tag which will output the current date/tine in the Unix format, which will be used later to compare against our Date field. More on that here: Where do I add the code samples you share?
Now, let's add a Custom Content field to our View and write the [gvlogic] shortcode comparison inside:
In that [gvlogic] comparison above, we are comparing our Due Date field to the current day/time to make sure we are still on time.
Here's our View again:
Now, to enhance our View, let's replace these texts with nice Dashicons:
And here's the resulting View: