Displaying File (attachment) field
Advanced Views natively supports the following file types:
WordPress: attachment
ACF: any File field
MetaBox: any File, FileAdvanced, FileInput, FileUpload field
Pods: any File field
1. How to display a File field
Add any File field
Save the Layout, copy its embedding shortcode
Embed Layout: paste the shortcode inside the target place
Advanced Views automatically creates HTML markup and loads file metadata (like name and url) into the template.
You can customize the Layout template to use the File render options.
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.
2. Displaying file details
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 ‘File Details’ Layout: This Layout will be responsible for displaying file details. In the Fields tab, assign the file fields you want to display, then publish the Layout.
Create a page Layout: Create a page Layout. In the Fields tab, add the target File field, and assign 'File Details' as a Field Layout, then publish the page Layout
Embed page Layout: copy and paste the page Layout shortcode inside the target place
That's it! Now you can customize the Layout template to use the File render options.
Last updated