Documentation

Search Templates & Merge Tags

Last modified: September 11, 2026

Introduction

Gravity Search provides flexible options for displaying Target Form entry data in search results, map info windows,
and individual entry displays.

You can build output using configurable Structured Fields or write Custom HTML with supported template tags. These tags can insert Target Form values, entry information, and, when the current output provides them, distance data and Details links.

The available tags depend on the output context. Results and map info windows can represent a specific entry-location result. Details Display is entry-level, and Page Content uses Gravity Forms merge-tag processing rather than the Custom HTML tag parser described below.

Gravity Search Info Window Output Mode settings

Output Modes

1. Structured Fields

Structured Fields mode lets you select Target Form fields and arrange display rows without writing HTML. It
is the recommended option when the built-in layouts provide the design you need.


2. Custom HTML

Custom HTML mode gives you direct control over the markup. You can combine supported HTML, CSS classes, Target Form field tags, Gravity Search template tags, and entry metadata. The rendered HTML is sanitized for safe WordPress output.

Structured Fields

Structured Fields mode builds output from settings rather than custom markup. The available controls depend on the output area:

  • Results: Visual Template, Title Field, title linking, Main Image Field, distance, Details link, and configurable result rows.
  • Map Info Windows: Visual Template, Title Field, title linking, Main Image Field, distance, Details link, and configurable info-window rows.
  • Details Display: Title Field, Main Image Field, and configurable Details Fields rows. Details Display does not offer distance or Details-link row sources.

The general workflow is the same: select the fields or supported entry values to display, optionally override row labels, choose a Text, Link, Link (New Tab), or Image format, and arrange the rows.

Use Structured Fields when you want consistent output without maintaining custom markup.

Gravity Search Info Window Structured Fields settings

Custom HTML

Select Custom HTML as the Output Mode when you need to create your own markup.

Depending on the section you are configuring, the HTML editor is labeled:

  • Result Item HTML under Results settings.
  • Table Header HTML when using a table results template.
  • Info Window HTML under Map settings.
  • Details HTML under Details Display settings.

Use the tag selector beside the editor when available to insert Target Form fields without entering field IDs manually. The selector inserts tags appropriate to the current Target Form; the reference below documents the additional built-in forms and modifiers.

Gravity Search Custom HTML output settings

Supported Custom Template Tags

The tags in this section are parsed in Gravity Search Custom HTML settings. Field and entry tags use the current Target Form entry. Location, distance, and Details-link output also depends on the context described with each group.

1. Entry Tags

  • {entry_id} outputs the entry ID.
  • {details_url} outputs the entry’s Details Page URL.
  • {details_link} outputs a link labeled “View Details.”
  • {details_link|View Full Details} outputs a details link with a custom label.

Details-link tags require a published Details Page under Search Setup → Details Routing. That configuration determines the destination and URL format. Details-link tags work in Results and map info-window Custom HTML; they render empty in Details Custom HTML because that output is already on the entry’s Details page.


2. Distance Tags

  • {distance} outputs the calculated distance value.
  • {distance_units} outputs the distance unit.
  • {distance_with_units} outputs the distance and unit together.
  • {distance|html} outputs the distance using Gravity Search’s formatted HTML.

Distance tags output content only when a proximity origin and calculated distance are available for the current entry-location result. They are intended for Results and map info windows and render empty in entry-level Details Custom HTML.


3. Target Form Field Tags

  • {field:4} outputs the value of field ID 4.
  • {field_label:4} outputs the label of field ID 4.
  • {field:4|html} outputs the field as a formatted row.
  • {field:4|image} outputs the value as an image when a valid image is available.
  • {field:4|details_link} links the field value to the Details Page.
  • {field:4|details_link:new_tab} opens that Details Page link in a new tab.

The two details_link field modifiers follow the same Details Page and output-context requirements as the entry-level Details-link tags.


4. Gravity Forms Field Tags

You can also use standard Gravity Forms-style field merge tags:

{Business Name:4}

The number following the colon is the Target Form field ID. This syntax is useful when inserting fields
through the merge-tag selector.

Phone fields also support formatted, e164, national, and country parts. For example, {Phone:4:e164} returns the E.164 value when that normalized part is available. The same modifiers can be used with field syntax, such as {field:4|e164}.


5. Entry Meta Tags

  • {date_created}
  • {date_updated}
  • {created_by}
  • {status}
  • {source_url}
  • {form_id}
  • {post_id}
  • {payment_status}
  • {payment_amount}
  • {transaction_id}

Creation and update dates can also be formatted using a WordPress-compatible date format:

{date_created|format:F j, Y}

Unknown brace tags are left unchanged so a typo remains visible during testing. Supported tags whose data is unavailable generally render an empty value.

Where Output Modes Are Used

  • Results: Choose Structured Fields or Custom HTML for each entry-location result item.
  • Map Info Windows: Choose Structured Fields or Custom HTML for each result marker’s info-window content.
  • Details Display: Choose Structured Fields, Custom HTML, or Page Content for the parent entry.

For Details Display, Structured Fields and Custom HTML appear where [gfgeo_search_entry] is placed on the selected Details Page. Use the Copy shortcode and Edit Page helpers on the Details Display tab. A generated Details URL supplies the Search and Entry IDs automatically.

Page Content works differently. It processes the selected WordPress page content using Gravity Forms merge tags such as {Business Name:4}. Do not add [gfgeo_search_entry] in Page Content mode. Gravity Search-specific Custom HTML tags such as {field:4}, {distance}, and {details_link} are not the Page Content tag format.

Custom HTML Examples

Basic Result Item

<div class="directory-item">
	<h3>{field:1|details_link}</h3>
	<p>{field:3}</p>
	<p>{distance_with_units}</p>
</div>

Result Item With an Image

<div class="directory-card">
	{field:5|image}
	<h3>{field:1|details_link}</h3>
	<p>{field:2}</p>
	{details_link|View Full Details}
</div>

Table Result Row

<tr>
	<td>{field:1|details_link}</td>
	<td>{field:3}</td>
	<td>{distance_with_units}</td>
	<td>{date_created|format:Y-m-d}</td>
</tr>

When using a table results template, enter the column headings separately in the Table Header HTML
setting.

Details Custom HTML

<article class="member-details">
	<h2>{Name:1}</h2>
	<p>Entry {entry_id}</p>
	<p>{field:3}</p>
</article>

Use field and entry tags for Details Custom HTML. Do not depend on distance or Details-link tags there because the Details view is entry-level and already represents the requested entry.

Template Context & Fallbacks

  • A matching entry can produce multiple Results items or markers when it has multiple qualifying locations. Each item keeps its own result-location identity and available distance data.
  • Details Display renders the parent entry. It does not retain the specific result-location or marker context selected by the visitor.
  • Distance output requires calculated distance data. Without a usable proximity origin, distance tags return no value.
  • Details-link output requires a published Details Page and an eligible generated Details URL.
  • Unknown Custom HTML tags remain visible instead of being silently removed, which helps identify typing or field-ID mistakes.

Best Practices

  • Start with Structured Fields unless your layout requires custom markup.
  • Use the merge-tag selector when available to avoid entering incorrect field IDs.
  • Keep display markup in the output settings and configure search behavior elsewhere in Search Settings.
  • Test Custom HTML with entries containing empty fields and missing images.
  • Test distance tags both with and without an active proximity search.
  • Test an entry with multiple qualifying locations so Results and marker templates can be checked separately from the entry-level Details view.
  • Configure and test the Details Page under Search Setup → Details Routing before adding details links to results or info windows.
  • Use [gfgeo_search_entry] only for Structured Fields or Custom HTML Details output; use Gravity Forms merge tags directly in Page Content mode.
  • Use valid table markup when creating custom table headers and result rows.
menu-circle