Tell us what you are trying to do?
Show file attachment title in button
Is there any documentation that you are following?
https://toolset.com/forums/topic/display-multiple-attached-files-as-download-links/#post-506926
https://toolset.com/documentation/user-guides/views/shortcodes-within-shortcodes/
Is there a similar example that we can see?
hidden link
(see three Datasheet buttons without file name)
What is the link to your site?
hidden link
Following the above post, I've added this code to my functions.php to register the shortcode
// Add file title to button
add_shortcode( 'wpv_display_file_name', 'wpv_display_file_title_func');
function wpv_display_file_title_func($atts) {
global $wpdb;
$atts = shortcode_atts( array(
'url' => '',
'info' => '', // title, alt or id return
), $atts);
$res = '';
$url = $atts['url'];
$attachment_id = $wpdb->get_var($wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE guid = %s", $url
));
if($atts['info'] == 'title'){
$res = get_the_title($attachment_id);
}
if($atts['info'] == 'alt'){
$res = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
}
if($atts['info'] == 'id'){
$res = $attachment_id;
}
return $res;
}
I've registered custom shortcode [wpv_display_file_name] in Toolset > Settings > Front-End Content > Third-party shortcode arguments. Note. the custom shortcode doesn't show in toolset shortcodes > fields and views list.
Then tried this code on my custom template to display the buttons
[wpv-for-each field="wpcf-product-specifications-2"]
<a href="[types field='product-specifications-2' link='true' output='raw'][/types]" target="_blank" >Download - [wpv_display_file_name info="title" url="[types field='product-specifications-2' link='true' separator=', ' output='raw'][/types]"]</a>
[/wpv-for-each]
Also tried to display one a the time without loop
{!{types field='product-specifications-2' title='{!{wpv_display_file_name file_url="{!{types field='product-specifications-2' link='true' output='raw'}!}{!{/types}!}"}!}' index='1' separator=', '}!}{!{/types}!}
Thanks in advance for your help
David