
You can include shortcodes inside the display
attribute of GFSearch using double curly braces ({{ ... }}
syntax). This allows you to embed other shortcodes—like gravitymath
, gfsearch
or any other shortcode—within the output for each entry.
Read more about the display attribute here.
Basic Syntax
Wrap any supported shortcode inside double curly braces:
[gfsearch display="Sum: {{gravitymath}}2+2{{/gravitymath}}"]
- Works with both self-closing and wrapped shortcodes
- Supports all shortcode attributes
- Placeholders like
{13}
will be parsed before the nested shortcode is run
Placeholder Behavior
When nesting a gfsearch
shortcode:
- The outer
gfsearch
processes its own placeholders in thedisplay
string first - The nested
gfsearch
processes its owndisplay
attribute separately after it runs - Use the format
gfs:id
(no curly braces) inside nested shortcodes to refer to placeholder values - Likewise, when referencing entry values inside formulas or shortcode attributes, you may need to use a custom merge tag
format. Using standard merge tags like{8}
or{gfs:8}
will break the shortcode. For example:
{{gravitymath scope='view' id='1014' filter='filter_19=gfs:21'}}~gfs.8.sum~{{/gravitymath}}
This correctly filters by field 21 and calculates the sum of field 8 using special merge tag syntax.
[gfsearch display="Lookup: {{gfsearch target='60' search='1' display='gfs:23'}}"]
John
[/gfsearch]
Best Practices & Caveats
- Don’t mix single and double quotes inside the
display
attribute—if the outer string uses double quotes, use single quotes inside:
display="{{gravitymath scope='view' id='1014'}}2+2{{/gravitymath}}"
- Even when using the Global Variables plugin, use the double curly brace syntax for your formulas if they are meant to run inside a GFSearch display attribute.
- Shortcodes inside the
display
string must either:- Return a value that can be shown as part of a string alongside other placeholders or text
- Or return a field/property ID when using the basic display format (e.g.,
display="gfs:23"
), which GFSearch will interpret and replace with the actual entry value
Examples
Nested shortcode with computed math:
[gfsearch display="Total: {{gravitymath}}~gfs.8+gfs.9~{{/gravitymath}}"]
Nested gfsearch to pull related field:
[gfsearch target='60' search='1' sort_key='3' display="Submitted by {16} on {3}. Related: {{gfsearch target='61' search='2' display='gfs:23'}}"]
John
[/gfsearch]
This could output something like:
Submitted by John Smith on 2024-07-15. Related: Completed