Plugin Planet

Premium WordPress Plugins

USP Pro enables users to submit many different types of files. In fact, as USP Pro is built with the WordPress API, it supports any file types that are supported by WordPress. Continuing from USP Pro Custom Fields, this Doc explains how to set up the fields required for custom file types, and how to display them anywhere in your theme template.

To enable users to submit custom file types, follow these steps:

Step 1: Visit the USP Pro Settings > Uploads Tab > “Allowed File Types”. There you must add the allowed file types to the list. For example, to allow PDF and DOC files, we would add the following to the list: “pdf, doc”.

Step 2: Add the following shortcode to your USP Form (customize as needed):

[usp_files class="" placeholder="" label="" required="" max="" link="" multiple="true" method="select" key="" types=""]

Step 3: After adding the shortcode to the form, view it on the front-end and try submitting a test post. Once the post submitted, view it in the WP Admin Area, and look for the attached custom field: “usp-file-1” (where “1” equals the file number).

Step 4: Once the custom field is available, it may be displayed using any suitable WP or USP template tag (there are many available!). One example is to add the following tag to the WP Loop in, say, single.php:

<?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:

http://example.com/wp-content/uploads/example.pdf

So then you can use this to create a link to the PDF (or whichever file type you are using) for download:

<a href="http://example.com/wp-content/uploads/example.pdf">Download</a>

Resources & References