Shortcodes

Groundhogg has a few builtin shortcodes that allow you to display conditional content on your website!

gh_replacements

You can use this shortcode to merge replacement codes into your content.

[gh_replacements]Hi {first}[/gh_replacements]

gh_contact

This shortcode is more or less the same as the above, but it works on a per-field basis, and you can also pass a default parameter in the event the field doesn’t exist.

[gh_contact field="first_name" default="Phil"]

Or something like…

[gh_contact field="email"]

gh_is_contact

You can use this shortcode to conditionally display content dependent on whether the current site visitor is a contact or not.

[gh_is_contact] Show this content if the visitor is a contact.[/gh_is_contact]

gh_is_not_contact

Conversely, this shortcode does the exact opposite of the above.

[gh_is_contact] Show this content if the visitor is not a contact.[/gh_is_contact]

gh_has_tags

You can use this shortcode to display content dependent on whether the current visitor has specific tags. Pass one or more tag IDs to the shortcode.

[gh_has_tags tags="1,2,3"] Show this content if the visitor has the given tags.[/gh_has_tags]

gh_does_not_have_tags

This does the opposite of the above, showing content only if the visitor does not have certain tags.

[gh_does_not_have_tags tags="1,2,3"] Show this content if the visitor does not have the given tags.[/gh_does_not_have_tags]
Was this article helpful to you? Yes No

How can we help?