File
Last updated
Was this helpful?
Last updated
Was this helpful?
The File meta field (e.g. ) allows a file to be uploaded and selected by using the native WP media popup.
Select the File field from your field group.
Fill out a label for the file in the Label field. This text will be prepended to the field. e.g. PDF Download: file-name.pdf
The Link Label is useful when you want to have more consistency in the output, fill out the Link Label to replace the link text of your file. By default the File name from the file attachment is used.
The default behavior for links to files is to open the file in the browser if the file type is supported (such as PDFs). However, in some cases, you might want to create a 'download' link that triggers an immediate download of the file instead of opening it in the browser.
You can wrap any image into the file link. This well-known technique provides a visual representation of the attachment, allowing users to click on the image to view or download the file.
Make sure both image and file fields are added to the target View, and amend the template to put the img tag inside the tag, as shown below:
By default, the File field is displayed as a link, which suits most use cases. However, in some instances, you might want to display detailed information about the file. For example, if you've created a file field where a video has been selected, you may want to display it as a video player.
All WordPress media items, including images and files (videos, PDFs), belong to the 'attachment' post type. This means you can use any standard post fields.
Here’s how to do it:
Create a Separate View for the File Display: Set up a new View specifically for the File display, selecting the appropriate fields (e.g., Post -> Attachment video), and save it.
That’s it! Your video will now be displayed with a video player. This approach can be used to display any post information, such as the author, updated date, etc.
To achieve this, you need to use the for the link in the template:
To display the video attachments, employ the , as shown below:
If the File field contains a browser-supported file, such as a PDF, you can display the file directly on the page using the :
Choose the View for the File Field: Select the newly created View in the View field of your File field settings, similar to how you would for any .