• Resolved alx359

    (@alx359)


    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

    (@dglingren)

    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

    (@alx359)

    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.