Hello,
There isn't such a built-in feature within Toolset plugins, but you can setup a custom shortcode to retrieve the file extension from custom field, for example, I assume it is a multiple instance custom file field "file", which is created with Types plugin, you can try these:
1) create a custom shortcode [get_mime_type], put below codes into your theme/functions.php:
add_shortcode('get_mime_type', 'get_mime_type_func');
function get_mime_type_func($atts, $content = ''){
// Attributes
extract( shortcode_atts(
array(
'option' => 'extension',
), $atts )
);
$content = wpv_do_shortcode($content);
$path_parts = pathinfo($content);
$res = '';
if($path_parts[$option]){
$res = $path_parts[$option];
}
return $res;
}
You can get the file extension, file name by specifying the shortcode attribute, for example:
[get_mime_type option="basename"] ... [/get_mime_type]
hidden link
2) Dashboard-> Toolset-> Settings-> Front-end Content
in option "Third-party shortcode arguments", fill the shortcode name: get_mime_type
3) In a single "Submissions" post content, output the file name as the link text, and output file extension as a CSS class name, output file URL as the link target.
using below codes:
<ol>[wpv-for-each field="wpcf-file"]
<li><a href="[types field="file" output="raw"][/types]" ><span class="[get_mime_type][types field="file" output="raw"][/types][/get_mime_type]">[get_mime_type option="basename"][types field="file" output="raw"][/types][/get_mime_type]</span></a></li>
[/wpv-for-each]</ol>
4) You will get the file extensions as below:
<ol>
<li><a href="<em><u>hidden link</u></em>"><span class="zip">file1.zip</span></a></li>
<li><a href="<em><u>hidden link</u></em>"><span class="gif">file2.gif</span></a></li>
</ol>
Then setup custom CSS codes to display the icons as what you want, for example:
More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each
Iterate through multiple items in a post meta field and output the enclosed text for each item. Including Types repeating fields.