GD > Dynamic Content

All Widgets come as Widgets, Shortcodes or Blocks. Learn more about our Super Duper Widgets.

The Dynamic Content widget can be used to output custom content dependent on a specific custom field value.

This is a very powerful widget, its uses are almost limitless.  See the examples section below.

If your end goal is to output a button or badge to show a value, the GD > Post Badge widget might be a better fit.

Widget Options

  • Post ID - Leaving this blank will use the current post ID from the page or the loop, or you can specify and exact post ID if needed.
  • Field Key - Selecting the custom field key to use as the conditional field.  Standard field values are also available here such as post_date.
  • Field condition - This is the condition to use for the field value. You can match it to an exact value or simply use "is no empty" to show if a value is set. Many comparison types are available.
  • Value to match - If a comparison condition is used that requires a matching value then this is where you can enter a matching value. 
  • Text - This is the text that will be output only if the field conditions are metUse %%input%% to use the input value of the field or %%post_url%% for the post URL, or the field key for any other info %%email%%.

Example Output

Basic Example

Output a screenshot of the listing website if it has been entered.
( this can be done via the GD > Post Images widget by default, this is just for example purposes here )

Widget input settings:
The output text will only show if the website custom field is not empty.
In the text input, the %%website%% variable will be replaced with the field value, which we then use the WordPress tool to generate an image URL for the website.

Output result:

Advanced Example

Use a 3rd party shortcode with some dynamic content to show specific new content.
Output specific WooCommerce products in a single page tab.

  1. Create a custom field for the product IDs. Depending on your directory you might want to make this an admin edit only field.

  2. Create a new shortcode tab and use the Dynamic Content shortcode to set the WooCommerce shortcode.
    [gd_dynamic_content key="product_ids" condition="is_not_empty"][products ids="%%product_ids%%"][/gd_dynamic_content]<br>

  3. Edit a listing and enter some WooCommerce product IDs, separated by a " , " comma if multiple.
  4. Visit the listing and you will see the entered products under the Products tab.

Show Endorsement when the listing is 'featured'.

[gd_dynamic_content key="featured" condition="is_not_empty"]%%post_title%% has met and exceeded our strict qualifications in order to receive our endorsement.[/gd_dynamic_content]

Show 'Related Listings" (ads) when the listing is NOT 'featured'.

[gd_dynamic_content key="featured" condition="is_empty"][gd_listings hide_if_empty="1" post_type="gd_place" related_to="default_category" post_limit="3" sort_by="az" title_tag="h3" layout="3" bottom_pagination="1" mb="3" slide_interval="5"][/gd_dynamic_content]
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us