{"id":42,"date":"2025-09-26T08:50:52","date_gmt":"2025-09-26T08:50:52","guid":{"rendered":"https:\/\/ska-blocks.com\/docs\/2025\/09\/26\/dynamic-content\/"},"modified":"2025-09-26T09:36:00","modified_gmt":"2025-09-26T09:36:00","slug":"dynamic-content","status":"publish","type":"post","link":"https:\/\/ska-blocks.com\/docs\/dynamic-content\/","title":{"rendered":"Dynamic content"},"content":{"rendered":"\n<p><strong>ska-blocks -> Options -> Dynamic content<\/strong> option allows you to set up commonly used data so that it can be kept all in once place. You can set an e-mail, phone, social media addresses or other custom data:<\/p>\n\n\n\n<a aria-label=\"View image in full screen\" data-pswp-height=\"658\" data-pswp-width=\"602\" data-ska-pswp=\"ska-pswp-1\" href=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-111.png\" class=\"block max-w-96 wp-block-ska-image image\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-111.png\" alt=\"Options under ska-blocks -&gt; Options -&gt; Dynamic content\" width=\"602\" height=\"658\"\/><\/a>\n\n\n\n<p>The values can then be referred to on other pages using <code>[ska-*]<\/code> shortcodes or, for links, using the Dynamic links interface:<\/p>\n\n\n\n<div role=\"figure\" class=\"wp-block-ska-image image\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/02\/image-1.png\" width=\"409\" height=\"272\" loading=\"lazy\"\/><\/div>\n\n\n\n<p>The dynamic links interface will appear on the block toolbar when using <a href=\"https:\/\/ska-blocks.com\/docs\/ska-blocks\/element-block\/\" data-type=\"post\" data-id=\"203\">Element<\/a> or <a href=\"https:\/\/ska-blocks.com\/docs\/ska-blocks\/text-block\/\" data-type=\"post\" data-id=\"213\">Text<\/a> blocks with the HTML tag name <code>&lt;a&gt;<\/code>. <\/p>\n\n\n\n<p>Not to be confused with another &#8220;link&#8221; item on the toolbar that is used for adding a link to Rich Text (as in it will not add a link to the block&#8217;s root element, but will wrap some part of the text inside the block in an additional <code>&lt;a&gt;<\/code> element which is not valid HTML):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-73.png\" alt=\"\" class=\"wp-image-419\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Dynamic content options<\/h2>\n\n\n\n<p>All the options have additional settings:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-112.png\" alt=\"\" class=\"wp-image-1610\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-113.png\" alt=\"\" class=\"wp-image-1611\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Widget<\/h3>\n\n\n\n<p>Enabling the &#8220;Widget&#8221; setting of a dynamic option will display it on the WordPress admin dashboard so that it can be conveniently edited.<\/p>\n\n\n\n<a aria-label=\"View image in full screen\" data-pswp-height=\"412\" data-pswp-width=\"1024\" data-ska-pswp=\"ska-pswp-2\" href=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-114-1024x412.png\" class=\"wp-block-ska-image image\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-114-1024x412.png\" alt=\"Dynamic content widget on the WordPress admin dashboard\" width=\"1024\" height=\"412\" loading=\"lazy\"\/><\/a>\n\n\n\n<p>The widget will be visible to all users with the <code>unfiltered_html<\/code> capability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Type<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Textarea<\/h4>\n\n\n\n<p>The content type option can be changed to &#8220;Textarea&#8221; for a bigger input in the widget.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Toggle<\/h4>\n\n\n\n<p>When using the &#8220;Toggle&#8221; type the value is considered &#8220;On&#8221; when there is any text and &#8220;Off&#8221; when there is no text.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-115.png\" alt=\"\" class=\"wp-image-1613\"\/><\/figure>\n\n\n\n<p>In the widget only a checkbox is shown.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/ska-blocks.com\/docs\/wp-content\/uploads\/sites\/3\/2024\/03\/image-116.png\" alt=\"\" class=\"wp-image-1614\"\/><\/figure>\n\n\n\n<p>This can be used in combination with the <a href=\"https:\/\/ska-blocks.com\/docs\/ska-theme\/conditions-block\/\" data-type=\"post\" data-id=\"291\">Condition<\/a> block and some code to provide a simple toggle for some content.<\/p>\n\n\n\n<div class=\"wp-block-ska-code not-prose ska-preset--ska-theme--code\"><header><span class=\"title\">Custom conditional using dynamic shortcode value as a boolean<\/span><span class=\"label language-php\">PHP<\/span><\/header><div class=\"content\"><pre class=\"code php language-php\"><code class=\"language-php\">function ska_condition_campaign_active() {\n\t$shortcodes = ska_blocks()->get('options')->get('dynamicShortcodes');\n\treturn isset($shortcodes&#91;'campaign-active']) &amp;&amp; !empty($shortcodes&#91;'campaign-active']);\n}<\/code><\/pre><button :class=\"{error: state === &apos;error&apos;, success: state === &apos;success&apos;}\" x-data=\"{state:&apos;&apos;}\" x-on:click=\"navigator.clipboard ? (navigator.clipboard.writeText($el.previousElementSibling.innerText), $el.innerText = `Copied!`, state = &apos;success&apos;) : ($el.innerText = `Can&amp;#039;t copy`, state = &apos;error&apos;)\" class=\"copy\" type=\"button\">Copy<\/button><\/div><\/div>\n\n\n<div class=\"ska-blocks-docs__wrapper not-prose\" x-data=\"{showContent: false, showMessage: false, showError: false}\" style=\"display:flex;flex-direction:column\">\n<div class=\"wp-block-ska-element ska-blocks-docs not-prose ska-preset--docs-blocks\">\n\n<\/div>\n<div class=\"ska-blocks-docs__controls\" style=\"order:-1\">\n\t<button class=\"code\" type=\"button\" x-on:click=\"showContent = !showContent\" x-text=\"showContent ? 'Hide code' : 'Show code'\" aria-pressed=\"showContent\">Show code<\/button>\n\t<div>\n\t\t<span class=\"message success\" aria-hidden=\"true\" x-cloak x-show=\"showMessage\" >Copied!<\/span>\n\t\t<span class=\"message error\" aria-hidden=\"true\" x-cloak x-show=\"showError\">Couldn&#8217;t copy!<\/span>\n\t\t<button class=\"copy\" type=\"button\" x-on:click=\"navigator.clipboard ? (navigator.clipboard.writeText($el.parentElement.parentElement.nextElementSibling.querySelector('pre').innerText), showMessage = true) : showError = true\">Copy blocks<\/button>\n\t<\/div>\n<\/div>\n<div class=\"ska-blocks-docs__content ska-preset--ska-theme--code\" x-cloak x-collapse x-show=\"showContent\" hidden>\n\t<div class=\"content\">\n\t\t<pre class=\"ska-blocks-docs__blocks code\"><code class=\"html language-html\">&lt;!-- wp:ska\/condition {&quot;condition&quot;:&quot;ska_condition_campaign_active&quot;} --&gt;\n&lt;div class=&quot;wp-block-ska-condition&quot;&gt;\n&lt;!-- wp:paragraph --&gt;\n&lt;p&gt;Get 30% off.&lt;\/p&gt;\n&lt;!-- \/wp:paragraph --&gt;\n&lt;\/div&gt;\n&lt;!-- \/wp:ska\/condition --&gt;\n&lt;!-- wp:ska\/condition {&quot;condition&quot;:&quot;ska_condition_campaign_active&quot;,&quot;value&quot;:&quot;false&quot;} --&gt;\n&lt;div class=&quot;wp-block-ska-condition&quot;&gt;\n&lt;!-- wp:paragraph --&gt;\n&lt;p&gt;You missed it.&lt;\/p&gt;\n&lt;!-- \/wp:paragraph --&gt;\n&lt;\/div&gt;\n&lt;!-- \/wp:ska\/condition --&gt;<\/code><\/pre>\n\t<\/div>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>ska-blocks -> Options -> Dynamic content option allows you to set up commonly used data so that it can be kept all in once place. You can set an e-mail, phone, social media addresses or other custom data: The values can then be referred to on other pages using [ska-*] shortcodes or, for links, using&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-ska-blocks"],"_links":{"self":[{"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":1,"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/posts\/42\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ska-blocks.com\/docs\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}