Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • Vidur Dhanda
    Participant

    I’m using the following shortcode:

    In post:
    [sc name="dynamic-progress-bar" pct_val="20"]
    [jet_engine component=meta_field field=”headline_val”]
    [/sc]

    Content:
    [su_progress_pie percent=%%pct_val%% text=”” after=”%” size=”200″ pie_width=”10″ text_size=”40″ align=”center” pie_color=”#7ce2f7″ fill_color=”#F73F43″ text_color=”#F73F43″ align=”none”]

    [su_progress_pie percent=$$enclosed_content$$ text=”” after=”%” size=”200″ pie_width=”10″ text_size=”40″ align=”center” pie_color=”#7ce2f7″ fill_color=”#F73F43″ text_color=”#F73F43″ align=”none”]

    su is from Shortcodes Ultimate (https://getshortcodes.com/docs-category/shortcodes/).
    The invocation with %%pct_val%% works. The invocation with $$enclosed_content$$ does not work. I have verified that $$enclosed_content$$ has the correct value.

    Is this expected behavior? I know I can use $$custom_field:headline_val$$ but I want to provide the custom field name per post (actually, multiple field names).

    Hi Vidur,

    The enclosed content parameter will work differently when it is passed as a value to another shortcode. Making any change would be regressive I guess.

    Ideally, $$enclosed_content$$ is meant for large content like HTML which you can’t pass via an attribute.

    So I would suggest passing the value via attributes.

    Also if possible you can restructure your shortcode content in a way that you are not passing shortcodes as value to another shortcode. Make sure you pass simple values strings, values from the post side. It is also easy to manage.

    You could create multiple shortcodes where the nested shortcode in the content have different values passed.

    Thanks,
    Aakash

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter