---
title: (Advanced) Customizing single entry table headings
url: "https://www.gravitykit.com/docs/gravityview/advanced-customizing-single-entry-table-headings/"
updated: "2026-06-03"
category: GravityView
---

# (Advanced) Customizing single entry table headings

If you want to modify the headings (`<th>`) on single entries in the Table Layout, here is some sample code that you can start with.

This is what the default looks like: just the field label, as configured in GravityView:

 ![A screenshot showing headings on the left and values on the right](https://www.gravitykit.com/wp-content/uploads/2026/04/file-kuQw4m4SFh.png)

---

This article contains custom code. [Learn how to add the code to your site](https://www.gravitykit.com/docs/gravityview/customizing-your-views/where-to-put-code-samples/).

### Replace the field label with the Gravity Forms field description

This is helpful when you want to display more detailed text in the View than what appears on the form itself. The code checks whether a description exists and substitutes it for the label when it does.

```
/**
 * Override the field label with the field description on Single Entry table layouts.
 *
 * @param string $label The label to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $label, $context ) {
	if ( empty( $context->field->field->description ) ) {
		return $label;
	}

	return $context->field->field->description;
}, 10, 2 );
```

```
/**
 * Override the field label with the field description on Single Entry table layouts.
 *
 * @param string $label The label to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $label, $context ) {
	if ( empty( $context->field->field->description ) ) {
		return $label;
	}

	return $context->field->field->description;
}, 10, 2 );
```

It looks like this. Note that the Email field label remains; that field did not have a description.

 ![Field descriptions are shown, except the Email field, which didn't have a custom description.](https://www.gravitykit.com/wp-content/uploads/2026/04/file-c3qI0pRRRe.png)

If you want to show **both the field label and the description**, you can use code like this:

```
/**
 * Override the field label with the field description on Single Entry table layouts.
 *
 * @param string $label The label to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $label, $context ) {
	if ( ! isset( $context->field->field->description ) ) {
		return $label;
	}

	return $label . '<div>' . $context->field->field->description . '</div>';
}, 10, 2 );
```

```
/**
 * Override the field label with the field description on Single Entry table layouts.
 *
 * @param string $label The label to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $label, $context ) {
	if ( ! isset( $context->field->field->description ) ) {
		return $label;
	}

	return $label . '<div>' . $context->field->field->description . '</div>';
}, 10, 2 );
```

That code will output field descriptions under field labels, like this:

 ![Showing field descriptions underneath the field labels.](https://www.gravitykit.com/wp-content/uploads/2026/04/file-ToZjaoy3tC.png)

### Overriding based on field ID

If you want to show different content based on the field ID, you can use the field ID context:

```
/**
 * Override the field label for field #1 to be the field description.
 *
 * @param string $label The label to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $label, $context ) {
	// Not field #1? Return original.
	if ( (int) $context->field->ID !== 1 ) {
		return $label;
	}

	return 'Example Override for Field #1';
}, 10, 2 );
```

```
/**
 * Override the field label for field #1 to be the field description.
 *
 * @param string $label The label to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $label, $context ) {
	// Not field #1? Return original.
	if ( (int) $context->field->ID !== 1 ) {
		return $label;
	}

	return 'Example Override for Field #1';
}, 10, 2 );
```

### Return different values based on the entry array

You may want to change the output based on the entry, and that’s possible as well:

```
/**
 * Override the field label based on the entry value.
 *
 * This is just a silly example to show that the entry array is available in the context.
 *
 * @param string $value The value to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $value, $context ) {
	$entry = $context->entry->as_entry();

	if ( empty( $entry['created_by'] ) ) {
		return $value . '(Logged out) ';
	}

	return $value . ' (Logged in)';
}, 22, 2 );
```

```
/**
 * Override the field label based on the entry value.
 *
 * This is just a silly example to show that the entry array is available in the context.
 *
 * @param string $value The value to override.
 * @param GVTemplate_Context $context The context.
 */
add_filter( 'gravityview/template/field/label', function( $value, $context ) {
	$entry = $context->entry->as_entry();

	if ( empty( $entry['created_by'] ) ) {
		return $value . '(Logged out) ';
	}

	return $value . ' (Logged in)';
}, 22, 2 );
```
