I have used JetEngine to create a custom Media meta field. How can I display a link to the media?
In case you want to output a link to a certain media file, it can be done with no sweat using the Attachment Link Callback addon (excellent for PDF and ZIP files).
Download the addon.
Just use one of the links below:
Crocoblock website – https://crocoblock.com/freemium/tools/
GitHub – https://github.com/MjHead/jet-engine-attachment-link-callback
NOTE. If you want the attachments to be opened in a new tab, please make sure to modify this file a bit. In the line 60, return sprintf, add a target=”_blank” attribute like so:
return sprintf( '<a href="%1$s" target="_blank">%2$s</a>', $url, $name );
Activate the plugin.
Upload it to the Plugins > Add New directory and activate the plugin once done.
Edit the necessary Listing.
Open the Listing you need in Elementor and add the Dynamic Field widget to it. Then configure the widget as shown below:
In the Source drop-down, choose “Meta Data”. Then select the custom Media field you’ve created with JetEngine (it’s called Media in our case, but yours can be named otherwise) in the Meta Field drop-down. Enable the Filter field output toggle. In the Callback tab, make sure to select the “Get attachment file link by ID” option.
Thus, the link to your media file will be displayed.