• Resolved jhdean

    (@jhdean)


    Hello David,

    When trying to adjust my template code to show the image title rather than literal “title”, I have found that with the following example code from the documentation:

    [+template: Summary: ([+caption+]|[+ description +]|[+title+]) +]

    I had to add another pipe character after the title choice at the end for it to not display an error.

    {+template:({+description+}|{+caption+}|{+title+}| )+}

    I don’t know whether this was an oversight in the documentation or If I just didn’t totally understand the example and muddled into a solution.

    Jeff

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Lingren

    (@dglingren)

    Good to hear from you again. Thanks for starting a new topic for your question, and for taking the time to include the source text from your shortcode.

    I hope I understand your issue correctly. Your first template ([+template: Summary: ([+caption+]|[+ description +]|[+title+]) +]) is taken from the “Content Templates” section of the Settings/Media Library Assistant Documentation tab. Your second example ({+template:({+description+}|{+caption+}|{+title+}| )+})looks like it comes from your own shortcode – the solution you ended up with; is that right?

    You don’t specify the error that was displayed, but I did notice that the first example uses square brackets while the second example uses curly braces. The square brackets are appropriate for MLA custom style and markup templates. The curly braces must be used in the parameters of the shortcode itself. For example,:

    [mla_gallery mla_caption="[+template:([+ description +]|[+caption+]|[+title+])+]"]

    will generate an error. It must be coded as:

    [mla_gallery mla_caption="{+template:({+description+}|{+caption+}|{+title+})+}"]

    I entered that second form in my test system and it is working properly, without the extra pipe character at the end.

    If I have missed some part of the issue or not understood it completely, any additional information you can provide will help me be more specific.

    The whole square bracket/curly brace issue is an unfortunate result of my inexperience in the early MLA development days. By the time I discovered that square brackets could not be used in shortcode parameters it was too late to change their use in custom style and markup templates. Live and learn, I guess.

    I will leave this topic unresolved until I hear back from you.

    Thread Starter jhdean

    (@jhdean)

    Hi David,

    Thanks for the explanation about square brackets and curly braces.

    I’m not sure where I had gone wrong before. I tried again with your code that didn’t the extra pipe character and it worked as it should.

    Jeff

    Plugin Author David Lingren

    (@dglingren)

    That’s excellent. Thanks for the update with your good news.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding Content Templates. Thanks for your interest in the plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Caption choices example code’ is closed to new replies.