Shortcodes allow you to perform predefined actions within your WordPress content automatically. For example, instead of creating and sending a private download link to each customer manually, you can use a shortcode to auto-generate and display the link on the download page.
Below is the list of all the shortcodes available on WordPress Amazon S3 – Wasabi Smart File Uploads plugin.
WordPress Amazon S3 – Wasabi Smart File Uploads
The [ssu_upload]
shortcode allows users to upload files on the frontend website to Amazon S3 or Wasabi bucket directly.
Example Shortcode
[ssu_upload button="Upload to S3"]
Attributes
The following attributes are shown within the sample shortcode above.
- description: the description of your upload form
- button: the upload button’s text
- Default: Upload to S3
- error_msg: The message shown when users failed to upload files
- Default: An unexpected error occurred while uploading your file, please try again later.
- success_msg: The message shown when users upload files successfully
- Default: File is uploaded successfully as follows
- class: Allow you to apply a style to the upload button and match your custom theme
Make file public
To make the files uploaded via [ssu_upload]
shortcode public, simply add the following code snippet to your (child) theme’s functions.php file.
add_filter( 'ssu_shortcode_public_acl', '__return_true' );
Define the upload folder
To upload files via [ssu_upload]
shortcode to a specific folder, simply add the following code snippet to your (child) theme’s functions.php file.
//Upload files to random folder add_filter( 'ssu_shortcode_upload_folder', function() { return 'random'; } );
Please note that if you define the SSU_FOLDER
with a non-existing name, our plugin will create a new folder with this name for you.
Display S3 file URLs
To display S3 URLs of uploaded files to your users, simply add the following code snippet to your (child) theme’s functions.php file or Code Snippets plugin.
add_filter( 'ssu_display_file_url_on_frontend', '__return_true' );