Document Shortcode
Summary
wpfilebase allows you to link to files on your page or display a list of files.
Required Attributes
tag
The same shortcode is used for both links to a single file and file lists. This specifies which if the shortcode will display a single file or list of files. file specifies a link to a single file and list specifies a file list.
Optional Attributes
id
The ID of the file or file category to be displayed. Omit to include all categories. Use a comma delimited list in quotes (ex, id='2,1') to include more than one category.
tpl
The display template of file links. For a single file, the options are:
- simple (default): include file name, file type icon and date and size
- full-info: include a thumbnail
- minimal: include only the file name and a file type icon
For a document list:
- minimal-list (default): include only the file name and the file type icon
- cat-list-full-info: includes thumbnails for the files
- simple-list: includes file name and file type icon and date and size of file
- minimal-list (default): include only the file name and the file type icon
altname
This specifies if the alternative title should be used. Set to true to display the alternative title if it is available. For a single file, any other string will be used as the name of the file.
search
A keyword or tag filter when displaying a file list. Only files that match this keyword or tag will be displayed.
num
The maximum number of files per page. Set to 0 for the default (no pagination), or -1 to disable pagination.
pagenav
Whether to include the navigation between pages when you have more documents then allowed per page. 1 to include navigation between pages (default), or 0 to exclude navigation.
sort
Specify the sort. Default is to sort by the file display name A-Z which is specified by sort='<file_display_name'. The < specifies acceding sort; to sort descending, prepend your sort field by >. The options for sort by file_display_name, file_name, file_version, file_hits, file_size,file_date, file_last_dl_time, file_path, file_id, file_category_name, file_category, file_description, file_author, file_license, file_post_id, and file_added_by.
Examples
Single file
[wpfilebase tag=file id=1 tpl=simple /] (default output)
This displays file id 1 with a simple template.
File list
[wpfilebase tag=list id=1 pagenav=1 /] (default output)
This displays a list with all files with category 1.
[wpfilebase tag=list tpl=minimal-list pagenav=1 num=0 sort='>file_category_name' /]
This displays a list of all the files in the site with no pagination sorted by file category name. Only the file name and file type icon are displayed.
[wpfilebase tag=list tpl=cat-list-full-info pagenav=1 num=6 sort='>file_last_dl_time' search=office /]
This displays a list of files from any category with the keyword of "office". It is sorted descending by the last time the file was downloaded. Six files are displayed at a time, and page navigation is displayed. The thumbnails are displayed along with the files.
Related articles