• Resolved bcrigler

    (@bcrigler)


    Is their a way using a conditional to load a separate markup template for each attachment that loads through 1 shortcode? For instance if I want a gallery of mixed post_mime_types. I may want a video thumbnail to load but load hidden inline content with the player in it for only video files. Or if it’s images I just want it to link out to the full size image. I want the templates to differ based on the mime_type. I can easily create different templates and point to that template using a shortcode only targeting video but I want a gallery mixed full of different media types.
    ex: [mla_gallery post_mime_type=video mla_markup=video_template]

    But I need one gallery paginated utilizing different markup templates on a per file basis in order to achieve this “mixed media gallery”. Do you have any tips on how to achieve this? I’m using the markup templates currently in order to load the players for audio/video.

    Any direction you can point me in would be great.

    Thanks,
    Brian

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

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

    (@dglingren)

    Thanks for posting this interesting question.

    The only way I can think of to accomplish this type of conditional template handling is to use the “MLA Gallery Filters and Actions (Hooks)” described on the Settings/Media Library Assistant Documentation tab.

    For your application you need to add logic to two of the provided hooks; mla_gallery_item_values_filter and mla_gallery_item_template_filter. In the item values filter you would look at $item_values['mime_type'] and save it (or just save the entire array) in a private static variable. In the template filter you would replace the HTML markup with whatever you need on an item-by-item basis.

    Using those two hooks will give you the flexibility you need. I am marking this topic resolved, but if you need more specific guidance or some sample code, let me know. Thanks again for the question and for your interest in the plugin.

    Thread Starter bcrigler

    (@bcrigler)

    David –

    You have amazing turn around time for answering questions and I love your plugin. I am going to work with this code suggestion. I believe that’s kind of where I was going I was looking at that hooks example file plugin and messing around but I am going to use your more direct guidance and try to achieve this if I hit a roadblock though it would be great if you could give me sample code. But I should be able to work off of this suggestion alone. I will let you know if I need a code sample and thanks again!

    – Brian

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different Markup Templates For Each Mime Type’ is closed to new replies.