{"id":680,"date":"2026-06-09T14:22:55","date_gmt":"2026-06-09T14:22:55","guid":{"rendered":"https:\/\/docs.wpinterface.com\/?p=680"},"modified":"2026-06-10T05:30:21","modified_gmt":"2026-06-10T05:30:21","slug":"dynamic-strings","status":"publish","type":"post","link":"https:\/\/docs.wpinterface.com\/dynamic-strings\/","title":{"rendered":"Dynamic Strings"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Dynamic strings are special placeholder tags that are automatically replaced with real-time, dynamic content when your site is displayed. This allows you to insert information like the current year, site name, or logged-in user&#8217;s name into text areas without manually updating them.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Available Dynamic Strings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following placeholders in any supported text field. Simply type the placeholder exactly as shown (including the double curly braces), and the theme will replace it with the corresponding value on the front end.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Dynamic String<\/th><th class=\"has-text-align-left\" data-align=\"left\">Description<\/th><th class=\"has-text-align-left\" data-align=\"left\">Example Output<\/th><\/tr><\/thead><tbody><tr><td><code>{{the_year}}<\/code><\/td><td>Displays the current year. Automatically updates each year \u2014 no manual changes needed.<\/td><td>2026<\/td><\/tr><tr><td><code>{{the_date}}<\/code><\/td><td>Displays the current date using the date format set in&nbsp;<strong>Settings \u2192 General<\/strong>&nbsp;in your WordPress dashboard.<\/td><td>June 9, 2026<\/td><\/tr><tr><td><code>{{site_title}}<\/code><\/td><td>Displays your site&#8217;s name as configured in&nbsp;<strong>Settings \u2192 General \u2192 Site Title<\/strong>.<\/td><td>My Business<\/td><\/tr><tr><td><code>{{theme_link}}<\/code><\/td><td>Outputs a link back to the theme page on WordPress.org.<\/td><td>Theme Name (linked)<\/td><\/tr><tr><td><code>{{current_user}}<\/code><\/td><td>Displays the display name of the currently logged-in user. If no user is logged in, it will be empty.<\/td><td>John Doe<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Where Can I Use Dynamic Strings?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dynamic strings can be used in the following areas of the theme, accessible via the&nbsp;<strong>WordPress Customizer<\/strong>&nbsp;(<strong>Appearance \u2192 Customize<\/strong>):<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Top Bar \u2014 Text Widget<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to&nbsp;<strong>Top Bar \u2192 Top Bar Widgets<\/strong>, add or edit a&nbsp;<strong>Text<\/strong>&nbsp;widget, and use dynamic strings in the&nbsp;<strong>Content<\/strong>&nbsp;field.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Copyright Bar \u2014 Text Widget<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to&nbsp;<strong>Footer \u2192 Copyright Bar \u2192 Copyright Bar Widgets<\/strong>, add or edit a&nbsp;<strong>Text<\/strong>&nbsp;widget, and use dynamic strings in the&nbsp;<strong>Content<\/strong>&nbsp;field.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Pre Footer \u2014 Call to Action Content<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to&nbsp;<strong>Footer \u2192 Pre Footer \u2192 Content<\/strong>, and use dynamic strings in the CTA text area.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Tip:<\/strong>&nbsp;Any text field in the Customizer that shows the message&nbsp;<em>&#8220;Shortcodes and basic HTML elements allowed. See the list of available dynamic strings.&#8221;<\/em>&nbsp;supports dynamic strings.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Allowed HTML Elements<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to dynamic strings, the supported text fields also accept&nbsp;<strong>basic HTML elements<\/strong>&nbsp;and&nbsp;<strong>WordPress shortcodes<\/strong>. You can use HTML to style your content \u2014 for example, adding links, bold text, or line breaks.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Supported HTML Tags<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Tag<\/th><th class=\"has-text-align-left\" data-align=\"left\">Description<\/th><th class=\"has-text-align-left\" data-align=\"left\">Example<\/th><\/tr><\/thead><tbody><tr><td><code>&lt;a&gt;<\/code><\/td><td>Hyperlink<\/td><td><code>&lt;a href=\"https:\/\/example.com\" target=\"_blank\"&gt;Visit Us&lt;\/a&gt;<\/code><\/td><\/tr><tr><td><code>&lt;strong&gt;<\/code><\/td><td>Bold text<\/td><td><code>&lt;strong&gt;Important&lt;\/strong&gt;<\/code><\/td><\/tr><tr><td><code>&lt;em&gt;<\/code><\/td><td>Italic text<\/td><td><code>&lt;em&gt;Emphasized text&lt;\/em&gt;<\/code><\/td><\/tr><tr><td><code>&lt;b&gt;<\/code><\/td><td>Bold text (alternate)<\/td><td><code>&lt;b&gt;Bold&lt;\/b&gt;<\/code><\/td><\/tr><tr><td><code>&lt;i&gt;<\/code><\/td><td>Italic (or icon)<\/td><td><code>&lt;i class=\"icon-class\"&gt;&lt;\/i&gt;<\/code><\/td><\/tr><tr><td><code>&lt;br&gt;<\/code><\/td><td>Line break<\/td><td><code>Line 1&lt;br&gt;Line 2<\/code><\/td><\/tr><tr><td><code>&lt;span&gt;<\/code><\/td><td>Inline container<\/td><td><code>&lt;span class=\"highlight\"&gt;Text&lt;\/span&gt;<\/code><\/td><\/tr><tr><td><code>&lt;img&gt;<\/code><\/td><td>Image<\/td><td><code>&lt;img src=\"image-url.jpg\" alt=\"Description\"&gt;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Supported Attributes<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&lt;a><\/code>\u00a0\u2014\u00a0<code>href<\/code>,\u00a0<code>rel<\/code>,\u00a0<code>target<\/code>,\u00a0<code>class<\/code>,\u00a0<code>role<\/code>,\u00a0<code>id<\/code><\/li>\n\n\n\n<li><code>&lt;img><\/code>\u00a0\u2014\u00a0<code>src<\/code>,\u00a0<code>alt<\/code>,\u00a0<code>width<\/code>,\u00a0<code>height<\/code>,\u00a0<code>class<\/code>,\u00a0<code>id<\/code><\/li>\n\n\n\n<li><code>&lt;span><\/code>\u00a0\u2014\u00a0<code>class<\/code><\/li>\n\n\n\n<li><code>&lt;i><\/code>\u00a0\u2014\u00a0<code>class<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Shortcode Support<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">All text fields that support dynamic strings also support&nbsp;<strong>WordPress shortcodes<\/strong>. Simply enter any valid shortcode directly in the text field, and it will be rendered on the front end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[your-shortcode attribute=\"value\"]<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Examples<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here are some practical examples of how to use dynamic strings:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Auto-Updating Copyright Notice<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\u00a9 {{the_year}} {{site_title}}. All rights reserved.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output:<\/strong>&nbsp;\u00a9 2026 My Business. All rights reserved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This will automatically update to the new year every January \u2014 no manual edits required.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Copyright with Theme Credit<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\u00a9 {{the_year}} {{site_title}} | Powered by {{theme_link}}<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Personalized Welcome Message (Top Bar)<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Welcome, {{current_user}}! Today is {{the_date}}.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output:<\/strong>&nbsp;Welcome, John Doe! Today is June 9, 2026.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Copyright with Custom Link<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\u00a9 {{the_year}} {{site_title}} | &lt;a href=\"\/privacy-policy\/\"&gt;Privacy Policy&lt;\/a&gt;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output:<\/strong>&nbsp;\u00a9 2026 My Business | Privacy Policy<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Combining HTML and Dynamic Strings<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;strong&gt;{{site_title}}&lt;\/strong&gt; \u2014 Est. 2020\u2013{{the_year}}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Output:<\/strong>&nbsp;<strong>My Business<\/strong>&nbsp;\u2014 Est. 2020\u20132026<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">For Developers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Extending Dynamic Strings<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can add your own custom dynamic strings using the&nbsp;<code>business_interface_parse_dynamic_strings<\/code>&nbsp;filter. Add the following code to your child theme&#8217;s&nbsp;<code>functions.php<\/code>&nbsp;or a custom plugin:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">phpadd_filter( 'business_interface_parse_dynamic_strings', 'my_custom_dynamic_strings' );function my_custom_dynamic_strings( $content ) {    \/\/ Replace {{my_custom_tag}} with custom content.    $content = str_replace( '{{my_custom_tag}}', 'My Custom Value', $content );    return $content;}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After adding the code above, you can use&nbsp;<code>{{my_custom_tag}}<\/code>&nbsp;in any text field that supports dynamic strings, and it will be replaced with &#8220;My Custom Value&#8221; on the front end.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Dynamic string not being replaced?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Make sure the placeholder is typed exactly as shown, including the double curly braces\u00a0<code>{{ }}<\/code>\u00a0with no extra spaces inside.<\/li>\n\n\n\n<li>Verify you are using the dynamic string in a supported text field (Top Bar Text widget, Copyright Bar Text widget, or Pre Footer CTA content).<\/li>\n\n\n\n<li>Clear any caching plugin or browser cache after making changes.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><code>{{current_user}}<\/code>&nbsp;shows nothing?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This placeholder only displays content when a user is logged in. For logged-out visitors, it will output an empty string. Consider wrapping it in a conditional message or using it only in areas visible to logged-in users.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Dynamic strings are special placeholder tags that are automatically replaced with real-time, dynamic content when your site is displayed. This allows you to insert information like the current year, site name, or logged-in user&#8217;s name into text areas without manually updating them. Available Dynamic Strings Use the following placeholders in any supported text field. Simply &hellip; <a href=\"https:\/\/docs.wpinterface.com\/dynamic-strings\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Dynamic Strings<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[21],"class_list":["post-680","post","type-post","status-publish","format-standard","hentry","category-general","tag-business-interface"],"_links":{"self":[{"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/posts\/680","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/comments?post=680"}],"version-history":[{"count":2,"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/posts\/680\/revisions"}],"predecessor-version":[{"id":683,"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/posts\/680\/revisions\/683"}],"wp:attachment":[{"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/media?parent=680"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/categories?post=680"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.wpinterface.com\/wp-json\/wp\/v2\/tags?post=680"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}