Plugin Planet

Premium WordPress Plugins

USP Pro makes it easy to display submitted content anywhere in your theme. Once a submitted Post, Page, or Custom Post Type is submitted and approved, it may be displayed using the shortcodes and template tags provided by USP Pro, as well as those provided by WordPress. Likewise, uploaded images, video, audio, and other supported file types may be displayed with granular control over the number, type, size, and other attributes of each file. Uploaded images may be used as featured images, displayed in post content, and/or displayed in post content automatically.

Post questions about Displaying Content using the form below.

Forum : Displaying Content

  1. Jon GorrieFebruary 22, 2014

    Regarding displayed images in the default Image Preview Demo:

    When displaying a post submitted with images, the images are displayed at my theme’s thumbnail size: 140×140

    How can I change this from the thumbnail size to say “medium” or “large” size, defined in the “Settings >> Media Settings” control panel? (here: http://example.com/wp-admin/options-media )

    • Jeff Starr

      Jeff StarrFebruary 22, 2014

      Step 1) Disable the Uploads Setting to “Auto-display images”

      Step 2) Add this code to your theme template in the loop (e.g., single.php):

      $images = usp_get_images('medium', '<img src="', '" />', 1, false); 
      
      foreach ($images as $image) echo $image;

      Much more is possible with this and other template tags; check out: USP Pro Shortcodes, and also: USP Pro Template Tags.

      • Jon GorrieFebruary 23, 2014

        Great, thanks! I’ll try to do it all with shortcodes first :)

  2. New UserMarch 10, 2014

    I’ve enabled custom post types for submitted content, but when I try to preview a submitted post from the front-end, I get a 404 Not Found error. The submitted post appears in the Admin Area, but not on the front-end in the theme.

    • Jeff Starr

      Jeff StarrMarch 10, 2014

      Great question. How your theme displays custom post types depends on its included template files. In general, to display custom post types, a theme must include two files: archive-custom-post-type.php and single-custom-post-type.php, where “custom-post-type” refers to the name of the custom post type.

      For example, to display the USP custom post type, the two required theme template files would be archive-usp_post.php and single-usp_post.php. USP Pro includes basic templates for each of these files that you can add to your theme. They are located in the /templates/ folder, and will give WP something to use to display the custom post types.

      If the template files are included and the custom post types still aren’t displayed, then there is another thing to try. As explained in the Tools > Tips & Tricks, try simply visiting the WP Settings > Permalinks screen.. doing so is reported to fix a well-known WP bug with custom post types and getting them to be recognized.

  3. New UserMarch 10, 2014

    How do I display custom fields on all posts?

    • Jeff Starr

      Jeff StarrMarch 10, 2014

      Add this to your theme template file (anywhere inside the Loop):

      <?php echo usp_get_meta(false, 'name-of-custom-field-1'); ?>
      
      <?php echo usp_get_meta(false, 'name-of-custom-field-2'); ?>

      Then where it says “name-of-custom-field..” replace it with the name of the custom fields used by the images you would like to display. These are viewable from within the Edit Post screen, beneath the post content area. If you don’t see any panel that says “Custom Fields”, visit the Screen Options from the top-right corner of the page, where you can enable/disable its display.

      Then once you’ve seen how this basic example works, you can use any USP or WP template tags to display exactly what is required, anywhere in your theme. Here is a handy table of USP Pro template tags:

      https://plugin-planet.com/usp-pro-template-tags/

  4. Francisco BarberApril 24, 2014

    Hi, when displaying a post submitted with images, the images are stuck (pegadas, muy unidas) you can see it. How can separate it with margin?? Thanks

    • Jeff Starr

      Jeff StarrApril 24, 2014

      Try adding some CSS to your theme’s style.css file:

      .usp-image { display: inline-block; margin: 0 5px 5px 0; }

      :)

  5. Bill StilwellApril 2, 2015

    How would I get a form to display in a Genesis child theme?

  6. Regnard RaquedanAugust 5, 2015

    Is it possible to combine inputs? For example, I want the eventual post title to be “Post Title + Custom Field”. Where would I edit the code to make this happen?

    • Jeff Starr

      Jeff StarrDecember 19, 2015

      Hi Regnard,

      I know that this question was answered offline, but I wanted to post here online for the sake of others.

      Something like that (combined inputs) is not done automatically, but you can do it by including two custom fields in your form: one for the first part of the title and another for the second part. Then you can use a template tag like get_post_meta() to display the fields together, for example:

      <?php
      
      $title_1 = get_post_meta(get_the_ID(), 'NAME_OF_CUSTOM_FIELD_1', true);
      $title_2 = get_post_meta(get_the_ID(), 'NAME_OF_CUSTOM_FIELD_2', true);
      
      echo '<h1>' . $title_1 . ' - ' . $title_2 . '</h1>';
      
      ?>

      That would go in the Loop in your single.php file (or whichever theme file that is relevant for your goals. You can get the names of the custom fields on the Edit Post screen beneath the post content in the Custom Fields panel for any submitted post. Note that you’ll probably want to customize the output to display as intended (markup, etc.)

  7. New UserDecember 19, 2015

    I love USP and I have a question. Is it possible to assign a fixed featured image to every post that is submitted? We don’t want to let the user choose an image. There must be one and the same image set as featured every time the user submits a post. Thanks for your help!

    • Jeff Starr

      Jeff StarrDecember 19, 2015

      This is something that you can do without using any plugin. Just do something like this in the Loop:

      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      
          <?php $is_usp = get_post_meta(get_the_ID(), 'is_submission');
          if ($is_usp) : ?>
      
          <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
              <h2><?php the_title(); ?></h2>
              <?php if (has_post_thumbnail()) the_post_thumbnail(); ?>
              <?php the_content(); ?>
          </div>
      
          <?php else :
              // not a usp post
              continue;
          endif; ?>
      
      <?php endwhile; else : endif; ?>

      That’s just an example to get you started, you’ll want to customize to suit your needs. More info on the Loop:

      https://codex.wordpress.org/The_Loop

  8. Hamid EbadiJune 30, 2016

    Hi I used in my post content break line but it does not appear when I publish posts.
    //what I write in the text area

    apple
    orange
    House
    nice

    // but what I got was
    apple orange House nice

    Break line did not translated :(
    what should I do?

  9. Tobias VogelOctober 7, 2016

    Hi Jeff,

    I have a “Member’s only” sub-page installed and want my USP Form only to be displayed for logged in users on this page. But it seems to me, that any visitor can visit the form through the permalink http://mysite.de/usp_form/nameofmyform. Am I wrong? And if not, how can I disable visitors to see the form through the permalink?

    Thanks in advance!

  10. Amelia SmallApril 16, 2017

    I have the USP Forms Pro installed as well as the Custom Post Type UI plugin, but how do I get a USP Form to post to a new custom post type instead of the standard WordPress “all posts” page?

    • Jeff Starr

      Jeff StarrApril 16, 2017

      You can add a hidden field to the form, for example:

      <input name="usp-custom-type" value="book" type="hidden" />

      ..would add a CPT of “book”. Here is complete infos on adding Custom Post Types with USP Pro.

      • Amelia SmallApril 16, 2017

        So I did that… but it’s not posting the fields… only the content box. Do I need to edit the CPT template to post the field submissions as well?

        This is the USP form page:
        http://www.mainedogmagazine.com/build-dogs-profile/

        This is the CPT once submitted:
        http://www.mainedogmagazine.com/dog_profile/tito/

      • Jeff Starr

        Jeff StarrApril 16, 2017

        Basically, yes. By default, most theme templates don’t display any custom fields (things like “dog name”, “breed”, “age”, and so forth). So as you suggest, you can either edit the CPT template to display the fields (using template tags), or you can use the free Helper Plugin to automatically display whichever custom fields you specify.

  11. New UserNovember 25, 2017

    Hi Jeff, thank you for USP Pro. My question: is it possible to have a form with several “text boxes” where unformatted text is entered and then is displayed in specific areas on the page when posted / published? Thank you!

    • Jeff Starr

      Jeff StarrNovember 25, 2017

      Glad to help. Yes, what you describe is possible with USP Pro. Here are the basic steps:

      1) First make sure to read and follow the Quick Start Guide, before messing with any settings.

      2) Once you are familiar with how the demo forms work, create a new form. Here is another good tutorial for creating forms.

      3) Add some fields to the form using the USP Quicktags (available when using the Text editor on any “Edit USP Form” screen. For example, you might do something like this:

      [usp_name]
      [usp_title]
      [usp_content]

      4) Then add a few of custom fields for your three “text boxes”. Here is a video tutorial that shows how to add Custom Fields.

      5) That’s it for the form, don’t forget to Publish the form and save changes.

      6) Submit a test post using the form you just created.

      7) Visit the test post in the Admin Area. You can view the custom fields in the “Custom Fields” meta box on the “Edit Post” screen. Tip: if you don’t see the “Custom Fields” box, you can enable it via the “Screen Options” (upper-right corner of the screen).

      8) Lastly, to display the custom fields, install the free Helper plugin, as explained in this tutorial. Also check out our tutorial on displaying Custom Fields for more information.

      That’s it in a nutshell. It takes some time to set up your first form and see how it works, but then other forms should go much quicker once you get the hang of it.

  12. New UserNovember 25, 2017

    This is a follow-up to an earlier question about links in posts (I’ve started a new topic because I can’t find the original question in the forum). Thank you for your reply, which has solved part of the problem. I’ve enabled post formatting and added the <a> tag, so that links inserted in posts are now preserved.

    But if, when inserting a link in a post, I check the “Open in new tab” option, the "target="_blank" seems to be stripped out when the post is submitted. Is there any particular tag I need to add to the Enable Post Formatting box to make this work properly.

    • Jeff Starr

      Jeff StarrNovember 25, 2017

      Glad to help. The target attribute is disabled by default for security reasons. See this article for infos.

      But if you are sure that you want to allow target attributes on submitted links, you can enable them by adding this snippet to your theme’s functions.php file:

      // USP Pro - allow custom attributes
      function usp_pro_add_custom_att($allowed_atts) {
      	$allowed_atts['target'] = array();
      	return $allowed_atts;
      }
      add_filter('usp_sanitize_content_atts', 'usp_pro_add_custom_att');

      No other changes need to be made, just save changes and done.

  13. New UserNovember 25, 2017

    Hey Jeff! I want to display links to my uploaded files, how can I do it?

    • Jeff Starr

      Jeff StarrNovember 25, 2017

      You can use the free Helper extension and combine fields, for example if you wanted to display links for two different file uploads, you could do something like this:

      [ <a href=" ]  [ usp-file-1 ]  [ ">   ]
      [           ]  [ usp-file-1 ]  [ </a> ]

      That would be for the first file link. And then you would add another two rows in the Helper plugin for the next link, for example:

      [ <a href=" ]  [ usp-file-2 ]  [ ">   ]
      [           ]  [ usp-file-2 ]  [ </a> ]

      Of course, you can modify the markup however is needed. The key is to split each link into two rows in the Helper plugin. That way you can use the file name/URL twice: once for the href value and another for the link text.

      • New UserNovember 25, 2017

        Thanks Jeff. What if I want to use an image for the link instead of the file URL?

      • Jeff Starr

        Jeff StarrNovember 25, 2017

        If you are using the Helper extension, you can add the URL of the image in the third helper field. For example if you have this:

        [ before custom field ] [ custom field name ] [ after custom field ]

        And you have an image located at, say: https://wherever.com/image.jpg

        Then you can do this:

        [ <p><a href=" ] [ usp-custom-1 ] [ " title="Download File"><img src="https://wherever.com/image.jpg"></a></p> ]

        Remember to replace the “usp-custom-1” with the actual name of your custom field.

Please log in to post a new forum topic.