Show documents and files on your school site with ease.
[smart-files] is a short code we have developed for use on your school site so that you can easily display a list of files that are either uploaded to your sites media library or uploaded into a Google Drive folder.
This screenshot shows a list of school policies and how they are displayed using the short code. These files are all uploaded by the user into a single Google Drive Folder.
This guide will go over the three methods of displaying files on your smartsite:
Displaying all the files attached to the post/page where the [smart-files] shortcode is used.
Displaying a specific category of files from your websites media library.
Displaying the contents of a public Google Drive Folder.
To achieve this you will need to use the shortcode without specifying a category or a folder_id. This will then perform the default behaviour which will grab and display a list of all the files currently attached to the page or post where the shortcode has been used.
You can display a group of files that have been uploaded into your smartSites media library once you have activated the plugin “Media Category Library” and grouped all of the files into a category. We will explain how to do this but the only code you will need to use on your page is the following:
The first set you will need to take is to activate the plugin called “Media Category Library”. To do this log into your wordpress dashboard and navigate to Plugins>Installed Plugins and search for “Media Category Library”. You may need to click on “Activate” if the plugin has not already been activated.
Once this plugin is activated you will be able to create a category and then assign files to this category so that multiple files can be grouped together. To create a category you need to log into your website dashboard and navigate to Media>Media Categories. Here you will be able to create a category that you can assign your media to.
Once you have created a category you can begin to assign your media to the category by navigating to “Media Category Library” (see below). Here you will be able to add new files or select files that have already been uploaded and assign them to a category.
Once all the files have been assigned to a category you can reference the name of the category in the short code and this will display all files within that specific category on your page.
To use the code you will add the category slug(url friendly name) to the example we have above so that your final result is:
All the code you will need is below and to replace “GOOGLE-FOLDER-ID” with the actual ID of a publicly shared Google Folder:
To use the short code you will firstly need to ensure that the folder you wish to display on your web page has it’s visibility settings set to public. This is done by going into sharing>Advanced and then setting the sharing option to “On - Public on the web” This will allow the short code to read and display the contents of the folder.
This box shows the public setting that needs to be applied to a Google Drive folder in order for it to display. Remember this is set so others can only VIEW and not edit your content
Once you have set the sharing options all you need is the ID of the Google folder. To obtain the ID of the folder simply open the folder up in Google Drive and then take the combination of letters and numbers that appear after the final forward slash (/)
We have an example below of which part of the Folders address is the ID:
The section of the URL above that is bold is the ID of the folder, feel free to test using this example ID: 0B9wAGIafx5ojbGJuY0FueHBjMms
To use the code you will add the folder ID to the example we have above so that your final result is: [smart-files folder_id="0B9wAGIafx5ojbGJuY0FueHBjMms"]
Quick Reference Guide
Displaying the attached files of a post/page:
Remember this will only show attached files, and not files inserted into that page
Displaying a category of files from your smartSites media library.
Remember to switch on and use the plugin called “Media Category Library” and assign the items to a category
Displaying the contents of a Google Drive Folder:
Remember the google folders sharing options must be set to “On - Public on the web”
per_page (default: 10)
This will paginate the list of files as specified. This can help to prevent long lists. Using “-1” as the value will show all the files no matter how many there are.
sort_by (default: “name”)
This allows you to set the default sort by setting. By default it will sort the files alphabetically but can also be set to “type” or “date-added”.
hide_controls (default: false)
This will hide the search/sort and pagination controls. This is handy when used to display only a small number of files (less than 5).
get_size (default: false)
Display the size of each of the files in the list.
Note: This will slow down the page load times significantly due to the browser having to check each of the files to calculate the size. We only recommend using this if it’s important.