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.