Athlone
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Toolset Galleries to work with Beaver Builder Galleries
Started by: Athlone in: Toolset Professional Support |
3 | 6 | 3 years, 11 months ago | ||
Gallery Field
Started by: Athlone
in: Toolset Professional Support
Problem: Solution: |
4 | 14 | 5 years, 6 months ago | ||
Display repeating list of pdf files with name (and downloadable link)
Started by: Athlone
in: Toolset Professional Support
Problem: I have a repeating file field that holds PDF files. I would like to loop over the list of files and display an unordered list that shows the file name as a downloadable link. Solution: You can use the wpv-for-each shortcode to loop over each instance in a repeating field, but there's no built-in way to extract the file name from the custom field value. The custom field value will include the full URL of the file. You can add this custom shortcode to your child theme's functions.php file: add_shortcode( 'my_file_name', 'my_file_name_func'); function my_file_name_func($atts) { $urls = $atts['file_url']; $fileparts = explode('/', $urls); return end($fileparts); } Then in the wpv-for-each loop, you can use it like this to extract the file name and construct download links: <ul> [wpv-for-each field="wpcf-upload-file"] <li><a href="[types field='upload-file'][/types]">[my_file_name file_url="[types field='upload-file'][/types]"][/my_file_name]</a></li> [/wpv-for-each] </ul> Relevant Documentation: |
2 | 4 | 6 years, 6 months ago |