• Resolved gavy1

    (@gavy1)


    Hi,

    I am wondering : is it possible to display information under each pictures of a gallery if the requested fields are not null ?

    I am creating a photographs gallery and for some i may have a date (stored in a custom field, see https://www.ads-software.com/support/topic/custom-field-mapping-with-iptc-creation-date/) and a title (for which I nwill create a new custom field is the answer to this topic is yes).
    When one or both of these two informations exist for a photograph, I would to display them beneath the photograph. I looked at the documentation – and maybe i missed it – but I still don’t know if this can be done.

    Thanks a lot for your answer!

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

    (@dglingren)

    Thanks for your question. There are a couple of ways to display information along with the items in your gallery display.

    The most flexible way to do this would be to create a custom markup template, which would give you complete control over the HTML markup around each item. This is probably overkill for your application.

    The easy way is to add an mla_caption= parameter to your shortcode. For example, you can use a Content Template to display your custom field when it is present, or the default caption when it is missing:

    mla_caption="{+template:(Date de tirage: {+custom:Date de tirage+})|({+caption+})+}"
    

    The vertical bar causes the template to display the first alternative if the data is present or move on to the second value if the first value is missing. The parentheses around each alternative will suppress the value if the data is missing. You can find more information on content templates in the Settings/Media Library Assistant Documentation tab.

    You wrote “a title (for which I will create a new custom field“. You might consider storing that value in the WordPress standard Caption (excerpt) field unless you have other plans for that field.

    I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions. Thanks for opening a separate topic for this question.

    Thread Starter gavy1

    (@gavy1)

    David, thanks for your answer, very useful !

    As suggested, I used the WordPress standard Caption field for the titles of my photographs and – using your message -, changed my code to :

    [mla_gallery attachment_category=”{+template:({+request:term_slug+}|a-bad-term)+}” link=”lightbox” size=full mla_caption=”{+template:({+caption+}<br/>)({+custom:Date de tirage+})+}” posts_per_page=25 meta_key=”Date de tri” orderby=meta_value order=ASC mla_nolink_text=”<br /><span style=’font-size:1.5em; font-style:italic;’>Cliquez sur une catégorie pour afficher les photos.<span>”]

    That works perfectly! I then added pagination, using the documentation, and now everything is like I hoped!

    I still have to prepare and upload all my photographs but thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Gallery : Displaying information under pictures’ is closed to new replies.