---
title: "Highlighting entries about to expire &#8220;today&#8221;"
date: 2026-04-23
updated: 2026-11-09
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravityview/shortcodes/highlighting-entries-about-to-expire/"
category: "GravityView > Shortcodes"
---

A status label next to each entry shows which tasks have expired, which expire today, and which are still on time. You can add one with the [`[gvlogic]` shortcode](https://www.gravitykit.com/docs/gravityview/shortcodes/gvlogic-shortcode/) in a [Custom Content field](https://www.gravitykit.com/docs/gravityview/getting-started-gravityview/using-the-custom-content-field/).

The examples use a form with a Task Description field (Single Line Text) and a Task Due Date field (Date) with the field ID 3.

## Add the status label

Edit the View, add a Custom Content field to the **Multiple Entries Layout**, and paste this code into its content box:

```
[gvlogic if="{Task Due Date:3:mdy}" less_than="{date_mdy}"]
<span class="gk-task gk-task-expired">Expired</span>
[/gvlogic]
[gvlogic if="{Task Due Date:3:mdy}" is="{date_mdy}"]
<span class="gk-task gk-task-today">Expires today</span>
[/gvlogic]
[gvlogic if="{Task Due Date:3:mdy}" greater_than="{date_mdy}"]
<span class="gk-task gk-task-on-time">On time</span>
[/gvlogic]
```

Replace `Task Due Date` and `3` with your Date field's label and field ID, then click **Update**.

![The Custom Content settings of a View field, with three gvlogic shortcodes that show Expired, Expires today or On time](https://www.gravitykit.com/wp-content/uploads/2026/04/gravityview-gvlogic-expiring-status-custom-content.png)`{Task Due Date:3:mdy}` prints the due date as `MM/DD/YYYY`. `{date_mdy}` prints today's date in the same format and uses the time zone from your WordPress General settings. Keep `:mdy` on the Date field's merge tag so that a day-first field is read correctly.

To compare with a relative date, write `relative:` before it, such as `greater_than="relative:+7 days"` for tasks due more than a week from now.

**Note**: To show or hide a whole field by date with no shortcode, [Field Conditional Logic](https://www.gravitykit.com/docs/gravityview-pro/advanced-filter/field-conditional-logic/) has a Date field condition with **Today**, **Yesterday** and **Tomorrow**.

## Style the labels

In the View's **Settings** box, open the **Custom Code** tab and paste this CSS into **Custom CSS**:

```
.gk-task {
  color: white;
  padding: 5px 15px;
}
.gk-task-expired {
  background-color: red;
}
.gk-task-today {
  background-color: yellow;
  color: black;
}
.gk-task-on-time {
  background-color: green;
}
```

![A View of tasks with due dates and a Status column showing On time in green, Expires today in yellow and Expired in red](https://www.gravitykit.com/wp-content/uploads/2026/04/gravityview-gvlogic-expiring-status-labels-page.png)

## Use icons for the status

Replace the three `span` tags with [Dashicons](https://developer.wordpress.org/resource/dashicons/) and leave out the text:

```
[gvlogic if="{Task Due Date:3:mdy}" less_than="{date_mdy}"]
<span class="dashicons dashicons-no"></span>
[/gvlogic]
[gvlogic if="{Task Due Date:3:mdy}" is="{date_mdy}"]
<span class="dashicons dashicons-flag"></span>
[/gvlogic]
[gvlogic if="{Task Due Date:3:mdy}" greater_than="{date_mdy}"]
<span class="dashicons dashicons-yes"></span>
[/gvlogic]
```

![A View of tasks with due dates and a Status column showing a check mark, a flag or a cross for each task](https://www.gravitykit.com/wp-content/uploads/2026/04/gravityview-gvlogic-expiring-status-icons-page.png)
*WordPress loads Dashicons only for signed-in users, so visitors see empty cells unless you load the icons for everyone. Add this code to your site:*
```
// Load Dashicons on the front end for every visitor.
add_action( 'wp_enqueue_scripts', function () {
    wp_enqueue_style( 'dashicons' );
} );
```

**Note**: Read [Where to put code samples](https://www.gravitykit.com/docs/gravityview/customizing-your-views/where-to-put-code-samples/) to add this code to your site.

To set a status by hand, use the [Entry Tags field](https://www.gravitykit.com/docs/gravity-forms-entry-tags/getting-started-with-the-gravity-forms-entry-tags/).