Title: mla_gallery conditional params?
Last modified: August 23, 2017

---

# mla_gallery conditional params?

 *  Resolved [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/mla_gallery-conditional-params/)
 * Need to check if given parameters are set or not, from shortcode or hook. Something
   like this:
 * `mla_link_href='{[+product:permalink+]|[+permalink+]}'`
 * tried hacking with `global $post` in `mla_gallery_attributes`, but it isn’t in
   the loop.
 * I see there’s `mla_gallery_the_attachments`, but don’t know how to modify `mla_link_href`
   for each item?
 * Please advise.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/mla_gallery-conditional-params/#post-9435125)
 * Thanks for the question and for posting the text of your example.
 * MLA’s Content Templates allow you to achieve the conditional testing you seek.
   You can find more information in the “Content Templates” section of the Settings/
   Media Library Assistant Documentation tab.
 * For your example, the syntax would be:
 * `mla_link_href='{+template:{+product:permalink+}|{+permalink+}+}'`
 * From a “hook” the easiest solution is to add the `mla_link_href` element with
   the above template to the shortcode attributes array. If you want to use the 
   results in your own code you can use the `mla_get_data_source` function:
 *     ```
       $my_setting = array(
       	'data_source' => 'template',
       	'meta_name' => '[+product:permalink+]|[+permalink+]',
       	'option' => 'raw'
       );
       $my_permalink = MLAOptions::mla_get_data_source( $post_id, 'single_attachment_mapping', $my_setting, NULL );
       ```
   
 * I am marking this topic resolved, but please update it if you have any problems
   or further questions regarding the use of Content Templates.
 *  Thread Starter [alx359](https://wordpress.org/support/users/alx359/)
 * (@alx359)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/mla_gallery-conditional-params/#post-9435210)
 * Thank you! The first one was exactly what I was looking for, but the hook may
   become handy too so I’ve referred this post in code for future reference.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘mla_gallery conditional params?’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [alx359](https://wordpress.org/support/users/alx359/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/mla_gallery-conditional-params/#post-9435210)
 * Status: resolved