USP Pro makes it easy to display submitted content anywhere using shortcodes and template tags. In this article, you’ll learn about “user shortcodes” that enable your visitors to display their uploaded information and files in their submitted post.
User Shortcodes
User shortcodes enable your visitors to compose their own posts. For example, if they are uploading an image, they can add [img-1]
to their post to display the image wherever they prefer. Here is a list of list of user shortcodes available as of version 1.9:
[url]
– displays the submitted URL[url_link]
– displays the submitted URL as a hyperlink[link]
– displays link using submitted URL and Post Title[name]
– displays a link using submitted URL and Author Name[file-1]
– displays a link to the first submitted file[file-2]
– displays a link to the second submitted file[file-3]
– displays a link to the third submitted file[item-1]
– displays a link to the first custom field[item-2]
– displays a link to the second custom field[item-3]
– displays a link to the third custom field[img-1]
– displays the first uploaded image[img-2]
– displays the second uploaded image[img-3]
– displays the third uploaded image[img-4]
– displays the fourth uploaded image[img-5]
– displays the fifth uploaded image[image url="http://example.com/image.jpg"]
– displays image based on value ofurl
attribute
Usage
- Visit the USP Uploads settings and enable “User Shortcodes”
- Add any User Shortcodes to the submitted post (before or after the post is submitted)
That’s all there is to it :)
About the [url_link] shortcode
The [url_link]
shortcode displays the submitted URL as a link. It accepts several attributes:
title: specifies the link's title attribute (default: none)
text: specifies the link's anchor text (default: URL field)
atts: specifies any custom attributes that should be included in the link markup (important: use single quotes for any attribute quotes) (default: none)
Here are some examples to give you a better idea:
Display the URL field as a link using default values:
[url_link]
Display the URL link with custom attributes:
[url_link atts="target='_blank' rel='noopener noreferrer'"]
Display the URL link with custom title attribute, link text, and attributes:
[url_link title="Link Title" text="Custom Link Text" atts="target='_blank' rel='noopener noreferrer'"]
Notice that within each attribute we are using single quotes. That is important in order for the shortcodes to work properly.