Shortcodes

Short Codes are used to embed single files, file lists or upload forms (Pro) into Posts or Pages.

A shortcode looks like this:
[wpfilebase tag="file" id=2 /]
This would insert the file with the ID 2 using the default file template (see Templates)

Parameters

Here’s a list of all available shortcode parameters. Note that some parameters are only available for certain tags.

Parameter NameDescription
tag (required)Possible values:
list
file
fileurl
attachments
browser
form (Pro)
idFile ID, Category ID or Embedded Form Tag (Pro)
pathRelative File or Category Path (either id or path can be specified, but not both parameters!)
tplTemplate Tag. If omitted default templates are used.
sortFile Property to sort files. You can sort by the following parameters: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
file_added_by
Add > prefix to sort descending (< is ascending, by default), e.g: [wpfilebase tag=list sort=">file_size" /] creates a file list where large files come first. You can sort by multiple files, seperate terms by comma (,). Example “>file_hits,<file_name”
showcats0/1 – To show categories in file lists, files will be grouped by category. Default is 0
sortcatsFor lists. Property to sort categories by (ignored if showcats=0)cat_name
cat_folder
cat_description
cat_path
cat_id
cat_parent
cat_num_files
cat_num_files_total
cat_order
numNumber. Limits the number of files in file lists (when pagenav is enabled, this is the number of files per page)
pagenav0/1 – Wether to show the page navigation if list is paginated.
linktextFor tag=fileurl only. Text for the link.
If linktext is empty or not given, the shortcode will just output the file URL (http://www….com/…/file.pdf). Otherwise it generates a HTML <a> element: <a href=”http://www….com/…/file.pdf”>linktext</a>
searchPro only. Search term to filter files in lists. Only matching files will be displayed.

Files and categories can either be selected by their id [wpfilebase tag=file id=123] or their path [wpfilebase tag=file path=sample_category/myfile.pdf] but not both: [wpfilebase tag=file id=123 path=sample_category/myfile.pdf]

 List

Generates sortable, paginated and searchable file lists.

[wpfilebase tag="list" id={category id} path="{category path}" tpl="{list template tag}" sort="{file_property}" showcats={0/1} sortcats="{cat_property}" num="{page limit}" pagenav="{0/1}" search="{searchterm}" /]

Either the id parameter or path parameter or none of both has to be specified. If none is given all categories are included. To include multiple categories seperate their IDs by comma: [wpfilebase tag="list" id="1,2,3" /]

If tpl is not given, default list template is used.

Default sortings (can be set in WP-Filebase Settings) are used if sorting parameters are omitted.

Use the search parameter to filter the list. Enter any search term like you would do it when you are using the search widget. The search filter includes all file meta data (name, descrtiption tags) and – if enabled – ID3 tags and also indexed keywords of PDF files. See Search

File

Embeds a single file using default or custom templates.

[wpfilebase tag="file" id={file_id} path="{file path}" tpl="{template tag}" /]

Either the id or the path parameter must be specified. If tpl is not given, default file template is used.

File URL

Inserts a download link for a file.
[wpfilebase tag="fileurl" id={file_id} linktext="{text of the link}" /]
Either the id or the path parameter must be specified. If linktext is set, it generates a hyperlink that links to the file. If not, it just gives out the URL of the file so you can use it in custom <a> tags like:
<a href="[wpfilebase tag=fileurl id={file_id} /]">...Linking text or HTML elements...</a>
Note that you can’t use double quotes ( ” ) when the shortcode is placed inside a HTML attribute like in previous sample. To open files in a new tab, add the target=”_blank” attribute:
<a href="[wpfilebase tag=fileurl id={file_id} /]" target="_blank">...Linking text or HTML elements...</a>

Attachments

This shortcode lists files attached to the current post. You can optionally specify a list template.

[wpfilebase tag=attachments tpl="{list template tag}" /]

Browser

Inserts an AJAX tree view to browse files like the File Browser

[wpfilebase tag="browser" id={category id} path="{category path}" /]

With id or path you can set the browser’s root category. If both paremeters are not specified the File Browser will show all categories.

Form

WP-Filebase Pro only. Embeds a form to upload files. Forms must previously be created with the backend WP-Filebase -> Embeddable Forms.

[wpfilebase tag="form" id="{form tag}" /]

In this case id ist not a number but the tag of the form to embed. See Embeddable Forms for details.

Search

With the search parameter you can filter results in file lists.

The following shortcode gives you a list of all files (including all categories) that have 3d in the name, description, ID3, etc. or are tagged with 3d:

[wpfilebase tag="list" search="3d" /]

You can additionally provide the template parameter, to use a different list template and/or set one or more categories to search in:

[wpfilebase tag="list" id="5, 67, {cat_id..}" tpl="{template tag}" search="3d" /]

This following shortcode illustrates the use of multiple search terms:

[wpfilebase tag="list" search="hotfix zip filebase" /]

This search matches all files with hotfix, zip and filebase somewhere in name or other meta data. Sample matching file name: “wp-filebase-hofix.zip”. The order of the space-separated terms does not matter.

Since WP-Filebase Pro 0.3.0.03, you can exclude files with matching keywords. Append the exlude operator (dash/hyphen-minus -) to the keyword that should be excluded from search:
[wpfilebase tag="list" search="filebase -hotfix" /]
This shortcode would lists all files matching on “filebase”, but don’t have “hotfix” in their names (or any other fields)

Addionally, you can use wildcards:

To search for ZIP files:
[wpfilebase tag="list" search="filebase *.zip" /]

Search for files with names beginning with “wp-filebase…”:
[wpfilebase tag="list" search="wp-filebase*" /]

Exclude ZIP files from search (exlude operator “-” combined with wildcard):
[wpfilebase tag="list" search="filebase -*.zip" /]

Note that search=”*filebase*” equals to search=”filebase”. That’s because if no wildcard is used, terms are automatically wrapped by them.

52 thoughts on “Shortcodes

  1. VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    Hi
    I have the pro version.
    I cannot seem to get embeddable file upload form to work
    I have place shortcode on page called file database
    username is steveadmin
    password Millie9656
    Any advice appreciated

    1. isral duke says:
      VA:F [1.9.22_1171]
      Rating: -1 (from 1 vote)

      i am also having trouble. When will the documentation be complete, or, can we ask a direct question here?

  2. Christien Paul says:
    VA:F [1.9.22_1171]
    Rating: +1 (from 1 vote)

    How can I create a shortcode that only displays the files I have tagged with my name? Or perhaps only the files that are associated to a specific author? I need to be the administrator that uploads contracts for clients to download. Naturally each contract is unique to each client.

    Please advise,
    CP

    1. Nick Adams says:
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)

      Is this possible? I will buy the Pro Plugin if this feature exists. Thanks!

  3. Massimo says:
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    Is there a way to filter the results ?

    1. Fabian says:
      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)

      It will be possible with the next update. There you will be able to specify a filter keyword in the shortcode so only matching files are displayed.

      1. Emma Funk says:
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)

        Has this been created yet? I can’t seem to get the “search” tag to work – it just shows all of the files in that folder, without searching. What I want is to have a table show all the files in that folder that are from the current year (search=”2013″) – can I use search or this filter you’re talking about to do that?

  4. Brett says:
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    Can we get a shortcode to limit by times a file has been displayed in a category? ie numcats?

    Currently I have real trouble just showing all categories of the latest version of my software.
    I use categories for platform access (so i have installer-ver100-win32, installer-ver100-linux for example) and that works great, but I don’t want to display all files, just the latest version of the software, so I tried

    1. using num=1 for each platform, with sort=file_name so it only shows the download for the highest version# for each platform. Problem is it shows empty platforms if the permissions are not set for them. I dont want platforms visible if there is no download link. (could i maybe use an if statement somehow for this?)

    2. use a file list, which just displays the files that the user has access to, without showing the rows for non accessible platforms, which is great, but there’s no way to make it stop. numcats=1 would solve this – if a file from each category is displayed x times, it would not list any more.

    Is this feasible or is there another way to do what i want?

    1. Brett says:
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)

      I stuck with #1 and just moved the whole rendering of the table row into the file template, and now i can list them all and not have any non permissable download entries ’empty’, so i guess this could be considered closed.

    2. Fabian says:
      VN:F [1.9.22_1171]
      Rating: 0 (from 0 votes)

      What is your shortcode for the list?
      Actually, categories should not appear if they dont’t have any matching files.

      1. Brett says:
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)

        The shortcode display is fine and working correctly, ie
        [wpfilebase tag=list id=40 tpl=fmodlist pagenav=0 num=1 sort=">file_name" /]
        [wpfilebase tag=list id=41 tpl=fmodlist pagenav=0 num=1 sort=">file_name" /]
        [wpfilebase tag=list id=38 tpl=fmodlist pagenav=0 num=1 sort=">file_name" /]
        etc
        Its just my original html that wrapped the shortcode had no way of dissapearing, so i just moved the html into the template, and now it dissapears.

        Instead of a big cut and paste job, i currently have 18 lines in my html that look like that (with different category ids) I thought it could be displayed once as a list, with a ‘catnum=1’ just so each cat id was only displayed once.

  5. SafCOM says:
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    Plugin works great. Just a request, when we specify ‘attachments’ as tag value in short-code, it displays all the attachments of a post. It would be ideal if we could specify the extensions so that attachment list will display files of that extension only.
    For example, a post with some images and a ZIP file attached, using attachment tag list all files including the images, the request is to make it show only the ZIP file and ignore the images.

    A great plugin nevertheless.
    Thanks.

  6. phil says:
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    It looks like your plugin is exactly what I was looking for (i.e. manage list of files per category).
    I just can’t seem to be able to select different template. I’m trying to show a flat list of a single category with the “Table” template with the following short code

    [wpfilebase tag="list" tpl="Table" id="1"/]

    I get this message on the page :
    [WP-Filebase]: WARNING: List template Table does not exist!

    if I don’t specify a template I can see my file list by with the default template…

    Can you tell me what am I doing wrong?

  7. VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    [wpfilebase tag="list" id="1" tpl="Table" /]

    Regardless of the tpl tag used, this shortcode always resolves the the Default template.

    Help or suggestions please?

    Pat Wood

    1. VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)

      I am hoping that someone from the developer is watching this forum/comments. Part of the reason to purchase the Pro was to get support, but it has been 2 days now and no reply. My support issue is a deal-killer for using Filebase. Please help.

      1. Fabian says:
        VN:F [1.9.22_1171]
        Rating: 0 (from 0 votes)

        Hello Patrick,

        sorry for the delay.
        The template name is case sensitive and only consists of lowercase caracters.
        [wpfilebase tag="list" id="1" tpl="table" /]

        should work.

        Regards
        Fabian

  8. Erik says:
    VA:F [1.9.22_1171]
    Rating: +1 (from 1 vote)

    Hello,

    Is it possible to filter the Filebrowser anytime soon? Filter on Platform, Language or so. That would be great.

  9. VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    Hi.
    Thanks so much for this very useful plugin. Recently I’v noticed there is a conflict with the WordPress Seo by Yaost plugin, so the download link doesn’t apper at the end of post automatically. I hope you make it possible to use a tag template (not just a shortcode) to add download automatically to posts via theme files, so we shoose the solution is ok for us.
    Thank you.

  10. lewis says:
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

    No matter what I try I cannot get any templates other than default to display.

    I tried [wpfilebase num=5 tpl="test" sort=">file_hits"/]

    I did create a test template and it will not load all I get is the famous error [WP-Filebase]: WARNING: List template test does not exist!

    Tried uppercase and lowercase.

    Any ideas on what I am doing wrong ?

    Also would like to display at the top of the page the top 10 downloads and then all other 40 downloads below that but I am getting the top 10 to display and then pagination below which I do not want. Is there a tag to force only the top10 files to display.

    this is setup at http://atozfitness.com/free-downloads

    Sincerely,
    Lewis

Leave a Reply

Your email address will not be published.