How to Use Nested Shortcodes in Shortcodes Ultimate Attributes
Content
Many users of the 'WP Shortcodes Plugin — Shortcodes Ultimate' want to create powerful, dynamic content by nesting one shortcode inside another. A common request is to use the su_permalink shortcode to generate a URL dynamically and then pass that URL into the data attribute of the su_qrcode shortcode.
This technique, known as using nested shortcodes, is documented by the plugin's team. The official method involves replacing the square brackets ([, ]) of the nested shortcode with curly braces ({, }) and using single quotes (') instead of double quotes for the attributes. For example:
[su_qrcode data="{su_permalink id='706'}" size="300" align="center" background="#ffffff"]
However, as seen in user reports, this does not always work as expected. The primary reason for this is that not every shortcode supports having other shortcodes within its attributes. The ability to nest shortcodes is dependent on how each individual shortcode was programmed. The su_qrcode shortcode, along with several others in the plugin, may not currently support this functionality.
How to Check and Troubleshoot
If you encounter an issue where a nested shortcode isn't working, follow these steps:
- Verify Support: First, assume the shortcode may not support nesting. The plugin's documentation specifically states that "some plugin shortcodes allow using other shortcodes in their attributes." This implies that it is not a universal feature across all shortcodes.
- Syntax Check: Double-check your syntax. Ensure you are using the correct curly braces and that all attribute values within the nested shortcode are enclosed in single quotes.
- Alternative Approach: If the nested shortcode fails, a reliable workaround is to use a custom function in your theme's
functions.phpfile or a code snippets plugin. You can create a custom shortcode that outputs the desired permalink, which can then be used within thesu_qrcodeshortcode.
While the nested shortcode feature is powerful, its availability is limited to specific shortcodes within the plugin. For advanced dynamic content, exploring custom code solutions often provides the most flexibility and reliability.
Related Support Threads Support
-
Child pages for every page include “Home”https://wordpress.org/support/topic/child-pages-for-every-page-include-home/
-
How to show up Pagenumbershttps://wordpress.org/support/topic/how-to-show-up-pagenumbers/
-
Suggestion: Add a nested ordered list shortcodehttps://wordpress.org/support/topic/suggestion-add-a-nested-ordered-list-shortcode/
-
запрос на расширение [su_private]https://wordpress.org/support/topic/%d0%b7%d0%b0%d0%bf%d1%80%d0%be%d1%81-%d0%bd%d0%b0-%d1%80%d0%b0%d1%81%d1%88%d0%b8%d1%80%d0%b5%d0%bd%d0%b8%d0%b5-su_private/
-
Subpages extendedhttps://wordpress.org/support/topic/subpages-extended/
-
How to display rss datehttps://wordpress.org/support/topic/how-to-display-rss-date/
-
Set length in topic / post text in su_postshttps://wordpress.org/support/topic/set-length-in-topic-post-text-in-su_posts/
-
Add roles to SU_MEMBERS shortcodehttps://wordpress.org/support/topic/add-roles-to-su_members-shortcode/
-
Child-Thumbnail in [su_posts]https://wordpress.org/support/topic/child-thumbnail-in-su_posts/
-
Is it possible to create an su_qrcode with a su_permalink as the data attribute?https://wordpress.org/support/topic/is-it-possible-to-create-an-su_qrcode-with-a-su_permalink-as-the-data-attribute/
-
Making su_posts open links in new tab?https://wordpress.org/support/topic/making-su_posts-open-links-in-new-tab/
-
su_posts – Sticky posts custom CSShttps://wordpress.org/support/topic/su_posts-sticky-posts-custom-css/
-
Exclude h2 from contenthttps://wordpress.org/support/topic/exclude-h2-from-content/
-
list of posts without commentshttps://wordpress.org/support/topic/list-of-posts-without-comments-2/
-
Add a filter or selector based on taxonomyhttps://wordpress.org/support/topic/add-a-filter-or-selector-based-on-taxonomy/
-
Add custom attributes to su_postshttps://wordpress.org/support/topic/add-custom-attributes-to-su_posts/
-
subpages exclude certain subpageshttps://wordpress.org/support/topic/subpages-exclude-certain-subpages/
-
Display first name only?https://wordpress.org/support/topic/display-first-name-only/
-
su_posts paginationhttps://wordpress.org/support/topic/su_posts-pagination/
-
Read more missing with su_posthttps://wordpress.org/support/topic/read-more-missing-with-su_post/
-
Highlight selected menu itemhttps://wordpress.org/support/topic/highlight-selected-menu-item-2/
-
Keeping HTML / Shortcodes in output of [su_posts]https://wordpress.org/support/topic/keeping-html-shortcodes-in-output-of-su_posts/
-
Detect where SU shortcodes are usedhttps://wordpress.org/support/topic/detect-where-su-shortcodes-are-used/
-
Limit excerpt in [su-posts]https://wordpress.org/support/topic/limit-excerpt-in-post-list-list/
-
Exclude h2 from contenthttps://wordpress.org/support/topic/exclude-h2-from-content-2/
-
not Class support [su_posts]https://wordpress.org/support/topic/not-class-support-su_posts/