The GFSearch Display Attribute

//

BrightLeaf

GF Search plugin

The display attribute for GFSearch controls what is shown for each matching entry. You can use it in two different formats:

 1. Basic Comma-Separated Field List

You can pass a simple comma-separated list of field or property IDs, like:

display="13,14,15"
  • This will output the values of fields 13, 14, and 15 for each matching entry.
  • By default:
    • Single field per entry → results are separated by commas
    • Multiple fields per entry → fields are separated by commas; entries are separated by semicolons
  • You can override the entry separator with the separator attribute (supports HTML).
  • Note: The behavior of the separator applies to both the basic comma-separated field list and the custom
    formatting with placeholders options. The separator is only applied when there is more than one entry returned by the
    search. To configure a blank separator, enter __none__.

2. Custom Display String with Placeholders

You can build a custom display using placeholders inside a string. This gives you full control over formatting, including HTML, text, and shortcodes.

display="Name: {13}, Email: {14}"

Placeholder Formats

You can use placeholders to insert entry values into the output:

  • {id} – standard numeric field or entry property (e.g., {13}{id}{form_id})
  • {gfs:id} – for non-numeric properties when used in contexts where merge tags may be parsed, such as Gravity View custom content widgets, confirmations, or notifications
  • gfs:id – used only in nested shortcodes
  • Tip: Use {id} for most numeric fields, and {gfs:id} for text-based meta like created_bydate_created, etc.

Default Values for Placeholders

You can include a fallback/default value inside a placeholder using ;:

{5;No Name Found}
{gfs:created_by;Current User}
  • Only curly-brace formats ({}) support default values.
  • Plain format (gfs:id;default) is not supported.

Placeholder Behavior Notes

  • If the first placeholder in your display string resolves to an empty value, the entire result will be treated as empty and skipped (unless a default value is configured).
  • Always match placeholders to real field or entry property IDs in your form.
  • Avoid nesting " inside the display string if you’re already using double quotes to wrap it — prefer single quotes inside instead.
display="<a href='mailto:{13}'>{13}</a>"  ✅
display="<a href="{13}">"                 ❌

Special Placeholders

  • {num_results} or {gfs:num_results} will be replaced with the total number of results returned.
    Useful when using limit=”all” or for showing counts like: “{num_results} entries found.”
  • To see which keys are available for use in the display or search attributes:This will return a list of all meta keys for the matched entry. You can customize the layout with the separator attribute.
  • Tip: You can also find meta-keys by hovering or clicking on column headers in Forms → Entries in the WP admin. The meta key appears in the URL.

Nested Shortcodes

You can include shortcodes inside the display attribute using double curly braces ({{ ... }} syntax). This allows you to embed other shortcodes—like gravitymathgfsearch or any other shortcode—within the output for each entry. Read more about nesting shortcodes in GFSearch here.