Here is a somewhat esoteric yet useful collection of notes, tips and tricks for working with USP Pro.

Hey! Just a heads up, the content of this post is taken from the USP Pro “Tools” settings (under the “Tips & Tricks” section). The below information is removed from USP Pro version 4.0+ to make the plugin a bit lighter. It is served here for reference purposes. Note that this information may or may not be relevant/applicable depending on your version of USP Pro.

Post Type Bug Fix

As explained in the WordPress Codex:

If your site uses custom permalinks, you will need to flush your permalink structure after making changes to your taxonomies, or else you may see a “Page Not Found” error. Your permalink structure is automatically flushed when you visit Settings > Permalinks in your WordPress dashboard.

So in general, an extra step is required to get WordPress to recognize theme templates for Custom Post Types (for example, single-post_type.php and archive-post_type.php). So if/when you get a 404 “Not Found” error when trying to view a custom post type (for example, at /usp_post/example/), try the well-known fix, which is to simply visit the WP Permalinks Settings. After doing that, things should be working normally again. If not, try clicking the “Save Changes” button on the Permalink Settings page, which is another reported solution.

Template Tags Best Practice

When including template tags provided by a plugin or theme, it’s good practice to precede the tag with a conditional check to make sure that the function exists. For example, instead of writing this:

echo usp_get_images();

..we can write this:

if (function_exists("usp_get_images")) echo usp_get_images();

The first method works fine, but PHP will throw an error if the plugin is not installed or otherwise available. So to avoid the site-breaking error, the second method is preferred.

Force Forms to Clear Contents

If you are savvy with CSS, it is trivial to style forms however and get them to clear preceding/parent elements. If you’re new to the game and just want a sure-fire way to get form fields to line up and look right, here is a well-known snippet of HTML/CSS that you can add to any form:

<div style="clear:both;"></div>

Just add that snippet after the last item in your form. It’s not exactly best-practices design-wise, but it’s pretty much guaranteed to do the job. Then later on you can replace the snippet with some proper CSS.

Minimum Posting Requirements

There are basically four types of USP Forms:

Each of these form types requires certain fields in order to work properly. For example, contact forms require the Email field (obviously). Make sure to read the linked tutorials for your form type, to make sure that it includes the minimum required fields.

Also: In addition to the above customizable forms, USP Pro provides Login/Password/Register form.

Shortcodes in Widgets

By default, shortcodes do not work when included in widgets. To make them work, just add this snippet to your theme’s functions.php file (or add via custom plugin):

add_filter('widget_text', 'do_shortcode');

Nothing more to do, but remember to re-add the snippet if/when you change themes. Learn more about this.

On Install, On Uninstall

When USP Pro is installed and activated, it creates four new options in the WordPress options table. That’s it. No new database tables are created. While the plugin is active, new content (i.e., post data and/or user profile info) may be added to the database, but no other changes are made anywhere by the plugin.

Also, when the plugin is uninstalled/removed via the WP Plugins screen, the four options it created are removed from the database. Note that the plugin does not delete any posted/submitted content or registered user data. So if any posts or users were added via USP form(s), it is up to the admin whether or not to remove them.

Custom Field Recipes

USP Pro supports unlimited Custom Fields. Here is a cheatsheet for various types of form elements. Click the links for more details.

  • Textareafield#textarea
  • Text Inputtype#text|placeholder#Orange|label#Orange
  • Radio Selecttype#radio|name#1|for#1|value#Oranges
  • Checkboxtype#checkbox|value#Oranges
  • Select/Optionfield#select|options#null:Option 1:Option 2:Option 3|option_default#Please Select..|option_select#null|label#Options

For more fields and other options, check out the Custom Field Reference and Custom Field Recipes.