USP Pro really shines when it comes to ease of use: building forms and displaying submitted content is quick and easy with a complete collection of Shortcodes and Template Tags. USP Pro provides Template Tags that make it easy to display submitted post content, author information, file uploads, and more. This guide serves as a reference for the most commonly used USP Template Tags.
Menu
Primary Template Tags
Tag Name | Tag Description | Parameter Definitions |
---|---|---|
display_usp_form() |
Displays a USP Form based on input ID (uses usp_form in usp-shortcodes.php). Syntax: display_usp_form($id, $class); |
|
usp_is_submitted() |
Returns a boolean (true/false) value indicating whether the specified post is user-submitted. Shortcode available for this tag. |
|
usp_get_submitted() |
Returns an array of submitted file URLs for the specified/current post. |
|
usp_get_images() |
Returns an array of the formatted URLs for image attachments. All attributes optional. Syntax: $images = usp_get_images('thumbnail', '', '', false, false); foreach ($images as $image) echo $image; |
|
usp_get_files() |
Returns an array of the formatted URLs for post attachments. Syntax: $files = usp_get_files('', '', 3, false); foreach ($files as $file) echo $file; |
|
usp_ids() |
Returns an array of the IDs for post attachments. Syntax: $ids = usp_ids(false, false); foreach ($ids as $id) echo $id; |
|
usp_attachment_link() |
Returns a formatted set of links to attachment pages for each post. Syntax: echo usp_attachment_link(false, false, false, false, false, false, false) |
|
usp_get_filename() |
Returns the filename of the specified attachment. Syntax: (in loop) echo usp_get_filename(false, '2'); , (outside loop) echo usp_get_filename('2544', '3'); |
|
usp_latest_attachment() |
Returns optionally formatted URL(s) of the latest attachment(s). Syntax: echo usp_latest_attachment('', '', false, false, 'file'); |
|
usp_get_meta() |
Returns the value of the specified custom field. Syntax: usp_get_meta(false, false); |
|
usp_get_all_meta() |
Returns all usp custom fields for current or specified post. Example Syntax: $usp_meta = usp_get_all_meta(false); foreach ($usp_meta as $key => $value) echo $key . ' => ' . $value . "\n"; |
|
usp_get_image() |
Returns formatted images from within post loop, or the same for specified images outside the loop (i.e., anywhere in the theme). All attributes optional. Syntax: echo usp_get_image(false, false, false, false, false, '', '', '', '', false, false, false, false, false); |
|
usp_get_author_link() |
Returns author name from custom field as a link (if URL exists) or plain text (if URL not available). Syntax: echo usp_get_author_link(); |
|
usp_get_avatar() |
Returns the avatar (image) of the specified submitter. Syntax: echo usp_get_avatar(false, false, false, false, false); |
|
usp_video_url() |
Returns url(s) of uploaded video(s). Currently supported video formats: mp4, m4v, webm, ogv, wmv, flv. Syntax: $video_urls = usp_video_url(false, false, false); foreach ($video_urls as $video_url) echo $video_url; |
|
usp_audio_url() |
Returns url(s) of uploaded audio file(s). Currently supported audio formats: mp3, ogg, wma, m4a, wav. Syntax: $audio_urls = usp_audio_url(false, false, false); foreach ($audio_urls as $audio_url) echo $audio_url; |
|
Secondary Template Tags
Tag Name | Tag Description | Parameter Definitions |
---|---|---|
display_usp_login() |
Displays a Login/Register/Password Form. Located in /inc/usp-login.php . Syntax: display_usp_login(); |
|
usp_get_form_id() |
Returns the post ID based on id or slug. Located in /inc/usp-forms.php . Syntax: $form_id = usp_get_form_id($form_id); |
|
usp_get_ip() |
Returns the current IP address. Located in /inc/usp-forms.php . Syntax: $ip_address = usp_get_ip(); |
|
usp_is_contact() |
Checks if form is contact form, returns true or false. Located in /inc/usp-forms.php . Syntax: $is_contact = usp_is_contact($form_id); |
|
usp_check_malicious() |
Checks string for malicious input, returns true or false. Meant for use with email input, see source. Located in /inc/usp-forms.php . Syntax: $is_malicious = usp_check_malicious($input); |
|
usp_clean() |
Cleans up input strings. Located in /inc/usp-forms.php . Syntax: $clean_string = usp_clean($string); |
|
usp_return_bytes() |
Returns number in bytes. Located in /inc/usp-forms.php . Syntax: $bytes = usp_return_bytes($value); |
|
usp_return_bool() |
Returns boolean response, “Enabled” or “Disabled”. Located in /inc/usp-forms.php . Syntax: $boolean = usp_return_bool($value); |
|
usp_get_art_directed() |
Includes any art-directed content for the current post. Usage: automatic functionality (you don’t need to include/use any template tag). To use, attach to a post any of the custom-fields listed in the next column. Tip: you can auto-attach art-directed custom-fields to submitted posts using a hidden custom input with the following value, for example:
|
|
Notes & Resources
- You can learn more about Template Tags in the WP Codex.
- Many of the Template Tags also are available in Shortcode flavor.
- All Template Tag attributes are optional unless stated otherwise.
- Check out
/inc/usp-functions.php
for additional notes about some of the Template Tags covered in this guide. - In addition to the Template Tags provided by USP Pro, there are numerous default WordPress Template Tags, as well as any Template Tags that may be included with your theme and/or active plugins.