USP Pro enables your visitors to submit many different types of files. In fact, as USP Pro is built using WP APIs, it supports any file types that are supported by WordPress. So continuing from USP Pro Custom Fields, this article explains how to set up the fields required for custom file types, and how to display them anywhere in your theme template.
Enable Custom File Types
To enable users to submit custom file types, follow these steps:
Visit the USP Pro settings ▸ Uploads Tab ▸ “Allowed File Types”. There you must add the allowed file types to the list, separated by commas. For example, to allow PDF and DOC files, we would add the following to the list:
Add the following shortcode to your USP Form. Feel free to customize the attributes to suit your desired configuration.
[usp_files class="" placeholder="" label="" required="" max="" link="" multiple="true" method="select" key="" types=""]
After adding the shortcode to your form, visit the form on the front-end and try submitting a test post. Once the post is submitted, view it in the WP Admin Area, and look for the attached custom field:
1 equals the file number).
Once the custom field is available, it may be displayed using any suitable WordPress or USP template tag (there are many available!). One example is to add the following tag to the WordPress Loop in, say, your theme’s
<?php echo usp_get_meta(false, 'usp-file-1'); ?>
Also here you would change
usp-file-1 to the Name of the desired custom field (it will be the same for all posts that are submitted via that specific form). Once this tag is added to your theme loop, it will display the value of the custom field, which would look like this for a submitted PDF file:
So then you can use this to create a link to the PDF (or whichever file type you are using) for download:
And of course you can customize the markup and text to suit your specific goals.