• Resolved n3ssi3

    (@n3ssi3)


    Hey,

    I try to create my own markup template, but I am stuck.
    Is there a documentation for it somewhere? So far I just copied what I needed from the already existing templates.

    But now I am stuck with this:
    <div class="description"><h3>[+caption+]</h3></div>

    I would like to actually only have the description div if there is a caption. is it possible to do something like:
    [if caption]<div class="description"><h3>[+caption+]</h3></div>[endif]

    or what would be the best solution to accomplish this?

    And my second question:
    Why is everything wrapped into tags?

    Maybe it would be easier to override in PHP, is that possible?

    Thank you for your help

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

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

    (@dglingren)

    Thanks for your questions.

    There is some documentation for style and markup templates in the “Style and Markup Templates” section of the Settings/Media Library Assistant Documentation tab. There is also “A Table-based Style and Markup Template Example” section in the documentation. I know they are more a reference than a tutorial and I wish I had the time to do more on the subject.

    There are several earlier support topics with additional examples, such as:

    Document list in tables

    PDF Feed alignment and numering results

    Attachment title as link

    Creating a post with Image metadata

    As you can see, I am happy to work on application-specific questions.

    You wrote “I would like to actually only have the description div if there is a caption.” You can do this with “Content Templates”; there is a section in the Documentation that describes them. Your specific example requires a Conditional template element, which will not generate any output if a substitution parameter such as [+caption+] is empty. Here is the syntax:

    [+template:(<div class="description"><h3>[+caption+]</h3></div>)+]

    The parentheses around your <div></div> tags specify the Conditional element. Content Templates allow you to do many common tasks without resorting to PHP code.

    You asked “Maybe it would be easier to override in PHP, is that possible?” The [mla_gallery] shortcode supports a comprehensive set of filters and actions that give you complete control over gallery composition from PHP code in your theme or in another plugin. There is a section in the Documentation that lists the hooks and many examples in the /media-library-assistant/examples/ directory that use them. For your example above a simpler solution is possible, but you can use the hooks to do more complex tasks when you need them.

    You asked “Why is everything wrapped into tags?” The [mla_gallery] shortcode is intended as an enhanced replacement for the WordPress [gallery] shortcode, and The classes and tags in the default templates are modeled as closely as possible on those found in [gallery] output. Many themes and other plugins look for these tags to do their own work and expect them to be present in any gallery display markup.

    I hope the above suggestions and examples get you started on adapting templates to your needs. I am marking this topic resolved, but please update it if you have any problems or further questions regarding custom style and markup templates. Thanks for your interest in the plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘Markup Templates Help Caption’ is closed to new replies.