Documentation

Search Templates & Merge Tags

Last modified: August 6, 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 your own Custom HTML with merge tags. Merge tags
dynamically insert field values, entry information, distance data, and Details Page links for the entry being
displayed.

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 complete control over the markup. You can combine HTML, CSS classes, Target Form
merge tags, Gravity Search merge tags, and entry metadata.

Structured Fields

Structured Fields mode builds the output from settings such as:

  • Title Field
  • Main Image Field
  • Show Distance
  • Show Details Link
  • Display Rows

The available settings vary slightly between Search Results, Map Info Windows, and Details Display, but the general
workflow is the same: select the fields you want to display and configure their labels and layout.

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 merge-tag selector beside the editor when available to insert Target Form fields without entering field IDs
manually.

Gravity Search Custom HTML output settings

Supported Merge Tags

Merge tags are replaced with data from the current Target Form entry when the output is rendered.

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 to be selected under Search Setup → Details Routing.
The Details Routing settings determine the destination and URL format. These tags are intended primarily for search
results and map info windows.


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 distance data is available for the current result.


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.

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.


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}

Where Output Modes Are Used

  • Results: Choose Structured Fields or Custom HTML for each result item.
  • Map Info Windows: Choose Structured Fields or Custom HTML for marker info-window content.
  • Details Display: Choose Structured Fields, Custom HTML, or Page Content for individual entries.

For Details Display, Structured Fields and Custom HTML appear where the [gfgeo_search_entry]
shortcode is placed on the selected Details Page.

Page Content works differently. It processes the selected WordPress page content and resolves
supported merge tags using values from the current entry. The shortcode is not required when using Page Content mode.

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.

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.
  • Configure and test the Details Page under Search Setup → Details Routing before adding details links to results or info windows.
  • Use valid table markup when creating custom table headers and result rows.
menu-circle