GD > Post Badge

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

The Post Badge widget is used to output a custom badge dependent on a specific custom field value.

If you need to output more than just a badge dependent on the value of a custom field then you can use the GD > Dynamic Content widget.

Widget Options

Some settings for this widget are advanced settings, reveal them by clicking the button next to save.

  • 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.  For post date enter value like +7 or -7.
  • Icon class - You can show a font-awesome icon in the badge by entering the icon class. E.g "fas fa-award"
  • Badge - Badge text. Ex: FOR SALE. Leave blank to show field title as a badge, or use %%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%%.
  • Link URL - Badge link URL. You can use this to make the button link to something, %%input%% can be used here if a link or %%post_url%% for the post URL.
  • Open link in new window - This will make the link open in a new tab/window.
  • Badge background color - Color for the badge background.
  • Badge text color - Color for the badge text.
  • Badge size - Set the size of the badge.
  • Alignment - How the item should be positioned on the page.

Example Output

For some examples, we can look at the default dummy data

The shortcodes used in the Archive Item template are:

[gd_post_badge key='post_date' condition='is_less_than' search='+30' icon_class='fas fa-certificate' badge='New' bg_color='#ff0000' txt_color='#ffffff' alignment='left']<br>[gd_post_badge key='facebook' condition='is_not_empty' icon_class='fab fa-facebook-f fa-fw' link='%%input%%' new_window='1' bg_color='#2b4be8' txt_color='#ffffff' alignment='left']<br>[gd_post_badge key='twitter' condition='is_not_empty' icon_class='fab fa-twitter fa-fw' link='%%input%%' new_window='1' bg_color='#2bb8e8' txt_color='#ffffff' alignment='left']<br>[gd_post_badge key='website' condition='is_not_empty' icon_class='fas fa-link fa-fw' link='%%input%%' new_window='1' bg_color='#85a9b5' txt_color='#ffffff' alignment='left']
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