• Resolved MACscr

    (@macscr)


    This is a great little plugin, but it would really be nice if it possible to set defaults for parameters. This way when the user hits the shortcoder button and the parameter input fields popup, they are populated with a default value that of course can be edited.

    Also, while I have your attention, what is the status of the supporting js/css links? Right now I have to enqueue in the themes functions.php and of course that happens on every page load. =/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @macscr,

    Sorry for the late reply.

    Thanks for the feedback. This is one most request feature. There is a backward compatible way to implement “default values” for custom parameter but I didn’t get a chance to implement that yet. Please expect this feature within couple of months.

    Regarding supporting custom JS/CSS it is something beyond the scope of the plugin’s motive but yet I’ll consider the possibilities based on the efforts needed.

    Thanks,
    Aakash

    Thread Starter MACscr

    (@macscr)

    Any update on those default values? Really needing that. Also, why limit the type of html is used within it? I dont see a reason not to allow css/js links.

    Plugin Author vaakash

    (@vaakash)

    @macscr,

    I’ll make sure that the next version has support for default values.

    Also there is no restriction on HTML/CSS/JS.
    Can you please detail on what issue you are seeing ?
    May be you can start a new thread for this discussion.

    Thread Starter MACscr

    (@macscr)

    I must be blind and i see that you added the feature, but i see no instructions on setting default parameter values.

    Plugin Author vaakash

    (@vaakash)

    You can simply use the “insert shortcode parameter” button to set default values for the custom parameter.

    https://i.snipboard.io/HXTJvw.jpg

    The format for default values is %%my_param:default value%%

    I’ll update the docs shortly.

    Thanks,
    Aakash

    Thread Starter MACscr

    (@macscr)

    Awesome. Exactly what I needed. Thanks!

    I think I missed it when testing because I accidentally did custom field versus custom parameter.

    Thread Starter MACscr

    (@macscr)

    Ah man, didnt realize that this doesnt create default values in the actual visual editor portion. Thats where it should be setting the default values. This way when the user is adding the shortcodes using the visual editor button and all the fields are present for the custom parameters, they will have defaults that they can change if needed, etc.

    Plugin Author vaakash

    (@vaakash)

    @macscr,

    hmm.. I didn’t quite understand. Let me explain how default values for custom parameter works.

    In shortcode content you place custom parameter with default values like this %%my_param:hello%%. While inserting the shortcode in the post, you set a value for this my_param like this [sc name="test" my_param="world"]

    In this case, my_param will be replaced with world.
    If you don’t provide any value i.e [sc name="test"] then the output will be hello which is the default value since no value is provided when the shortcode is used.

    Thread Starter MACscr

    (@macscr)

    I get that, but for good user experience, they really should be populated here instead. Ive provided a screenshot of what I mean: https://www.screencast.com/t/BMHKhwf09

    Plugin Author vaakash

    (@vaakash)

    @macscr That is not possible.

    You can have the same custom parameter with “different” default values.
    In that the default value can’t be populated in the insert shortcode window.

    i.e when shortcode contains %%my_param:hello%% and %%my_param:world%% though the parameter is only one (my_param) it has two/more default values.

    Thread Starter MACscr

    (@macscr)

    That makes zero sense. Thats not how defaults work typically. If someone wanted to have different default values, they would use two different custom parameters. That isn’t a proper use case at all and makes no logical sense.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Default Parameter Values’ is closed to new replies.