Link to PDF Media file in CPT Repeater Fields

Short Answer
Are you having problems to add a link to your media file in a listing or template? At the moment this only works for repeater fields.. add a “dynamic repeater” widget and choose your source, then add this to the item format: %media-name% NOTE: there is NO ” after the href=

Are you one of many that has tried to create a listing for your clients CPTs and want to have the possibility to add a link to a PDF that opens in another tab?

After a long search and many tests, I found this method that works:

In your cpt, add a meta field repeater type. In my case I added 2 internal fields: document name (text) and file upload (media)

then in your listing or template you have to use the “dynamic repeater” widget, choose your repeater in the source and then in the “item format” box add: <a href="/en/%file|file_url_by_id%”/" target="”_blank”" rel="”noopener" noreferrer”>%media-name%</a> note that there is no ” after the href= if you put it, the link won’t work..

After that all you have to do is style it as you wish ;)

en_USEnglish

Questo sito fa uso di cookie per migliorare l’esperienza di navigazione degli utenti. Può conoscere i dettagli consultando la nostra privacy policy qui. Proseguendo nella navigazione si accetta l’uso dei cookie; in caso contrario è possibile abbandonare il sito.