Shortcodes

WP Fusion includes a few shortcodes to make it easier to manage your content.

Displaying User Meta

You can use shortcodes to display meta data for logged in users. The syntax is pretty simple. For example, to show a user’s first name:

[user_meta field="first_name"]

Any field listed in the Contact Field tab of WP Fusion’s settings can be accessed in this way.

You can also display different information for users who haven’t registered yet, or aren’t logged in, like so:

Welcome, [user_meta field="first_name"]Guest[/user_meta]!

Logged in users will see their first name, while visitors will see “Welcome, Guest!

 

Restricting Content

Restricting content based on logged in status

You can use the following two shortcodes to show content based on whether or not a user is logged in, regardless of thier tags. This works like:

[wpf_loggedin]Only visible to logged in users[/wpf_loggedin]
[wpf_loggedout]Only visible to logged out visitors[/wpf_loggedout]

Restricting content based on tags

To restrict content based on a user’s CRM tags, wrap the desired content in the WP Fusion shortcode, using the examples below.

This content will only show if the user is logged in and has the tag “New Customer”:

[wpf tag="New Customer"]Restricted Content[/wpf]

This content will only show if the user is logged in and has both the tags “New Customer” and “Purchased Course”:

[wpf tag="New Customer,Purchased Course"]Restricted Content[/wpf]

To show content only if a user doesn’t have a certain tag, use the following syntax:

[wpf not="New Customer"]Restricted Content[/wpf]

You can also combine parameters for more advanced locking, like so:

[wpf tag="New Customer" not="Payment Failed"]Restricted Content[/wpf]
Note: By default, WP Fusion will only unlock the content if the user has all of the tags in the list. To make it so that the content will unlock when any of the tags are found, include method="any" in the shortcode.

Else Conditions

The [wpf] shortcode also supports an “else” condition. The usage works like so:

[wpf tag="New Customer"]
Shows only to users with the "New Customer" tag
[else]
Shows to all logged in users who don't have the "New Customer" tag
[/else]
[/wpf]

Logged Out Parameters

By default, content in the shortcode will always be hidden from users who aren’t logged in. You can change this by adding logged_out to the shortcode. For example:

[wpf not="New Customer" logged_out]
This will show to everyone who doesn't have the "New Customer" tag, including logged out visitors.
[/wpf]

or:

[wpf tag="New Customer" logged_out]
Shows only to users with the "New Customer" tag
[else]
Shows to all users who don't have the "New Customer" tag, as well as logged-out visitors.
[/else]
[/wpf]

 

Updating Data

You can insert a shortcode into your pages to force an update of a users tags and/or meta data before the rest of the page is displayed.

To force an update of the current user’s tags, use:

[wpf_update_tags]

To force an update of the current user’s meta data, use:

[wpf_update_meta]