1. Home
  2. Docs
  3. Passster
  4. Shortcode

Shortcode

To protect parts of your content you use the shortcode implemented in Passster which named the same. A basic shortcode example:

[passster password="123"]your hidden content[/passster]

Explanation

Like every other closing shortcode in WordPress this one is build of three parts. The start tag [passster] optional parameters like password with a value (in this example 123) and a closing tag [/passster].

You can learn more about the general usage of shortcodes directly from the WordPress documentation here: The Shortcode API .

Parameters for Protection

You allready know how to add a parameter so now let’s get into the details about the possible parameters within Passster. We start with the parameters which directly impact the protection:

Password

[passster password="123"]your hidden content[/passster]

If you set the password parameter within the shortcode it should display a password from on the frontend of your site like this:

Shortcode 1

Captcha

Beside from using a password to protect your content, you can also use a captcha. The integrated math captcha is easier to read, more secure and is embed as a canvas object (image). The shortcode looks like this:

[passster captcha="true"]your hidden content[/passster]

The result in the frontend of your website should look like this:

Shortcode 2

ReCaptcha (Pro)

Beside using the math captcha you can also use the ReCaptcha (pro version needed). It use the Google v3 ReCaptcha API and implements a hidden captcha. The shortcode looks like this:

[passster recaptcha="true"]your hidden content[/passster]

The result in the frontend of your website should look like this:

Shortcode 3

To use it you need a valid Google ReCaptcha key and secret which you can get here: www.google.com/recaptcha/intro/v3.html

Go to Passster->Settings->External Services and fill out the necessary fields and save your option. Now you can use the ReCaptcha protection.

Shortcode 4

Passwords (Pro)

Instead of a single password you can also use multiple passwords within the pro version of Passster. To do that you need to modify your shortcode like this:

[passster passwords="123,345,678"]your hidden content[/passster]

As you can see you can add multiple passwords comma separated. All spaces between each comma will be filtered out automatically so you don’t have to worry about that.

Shortcode 1

As you may have noticed the result in the frontend remains the same as with the password parameter.

Password Lists (Pro)

In addition to multiple passwords I introduced password lists to manage a large set of passwords effectively.

To use a list you first need to create one. Move to Passster -> Password Lists and create one. You should see a screen like this:

Shortcode 6

You have basically two fields here. Passwords to fill in your lists of passwords and the option to expire passwords directly after there were used.

After you created your list you can copy the shortcode directly from the admin area in Passster->Password lists

Shortcode 7

The Password lists are referenced by there ID. So in my example the list have the ID of 6 so the result of the shortcode looks like this:

[passster password_list="6"][/passster]

With password lists you are able to modify your set of passwords anytime you like and don’t have to touch a single shortcode.

The result in the frontend is as espected the same as with password:

Shortcode 1

Parameters for Texts

While you set your global texts for the headline, the description, the error messages, etc. inside of the Customizer you sometimes want to overwrite it for specific shortcode. That’s why I implemented that too. For reference, we will use our password shortcode example from the beginning.

Headline

You can modify the headline for a specific shortcode with setting the headline parameter like so:

[passster password="123" headline="Your Custom Headline"]your hidden content[/passster]

Instruction

You can modify the instruction text for a specific shortcode with setting the instruction parameter like so:

[passster password="123" instruction="Your Custom Instruction"]your hidden content[/passster]

Placeholder

You can modify the placeholder text for a specific shortcode with setting the placeholder parameter like so:

[passster password="123" placeholder="Your Custom Placeholder"]your hidden content[/passster]

Button

You can modify the button text for a specific shortcode with setting the button parameter like so:

[passster password="123" button="Your Custom Button Text"]your hidden content[/passster]

Advanced Parameters

Passster exists for quite a while and is used to fullfill a multitude of use cases. Sometimes I get support requests which can not be solved with the existing solution, that’s the time I occasionally implement new parameters to Passster.

ID

This is a simple one. It’s used to set a additonal unique ID to the password form. It’s used like this:

[passster password="123" id="your-id"]your hidden content[/passster]

API

This one was introduced due to the requirement to verify passwords from an external data storage. If you are interested, I wrote an entire blog post about that: How to use Passster with 1.3 Million Codes.

The shortcode can be used in combination with the protection parameters like so:

[passster password="123" api="your-api-parameter"]your hidden content[/passster]

It’s basically a filter which returns the protected content if it get’s true (default is false):

$status = apply_filters( 'passster_api_validation', false, $input, $api );

AMP

Most of you know AMP. Googles answer to fast mobile pages for mostly news-related websites. You can use Passster also in the AMP version of your website if you include this parameter:

[passster password="123" amp="true"]your hidden content[/passster]

Hide

Imagine you have multiple protected areas on a page and it looks pretty uncommon to have multiple password forms in there. The hide parameter is here to help. Use the shortcode multiple times with the same password and set the hide parameter to all other shortcodes like so:

[passster password="123" hide="true"]your hidden content[/passster]

Now there is only one password form visible, but when the user unlocks the content it automatically unlocks all content at once. Awesome, right?

Partly

This is the most unknown and to be honest rarely used parameter in Passster. It gives you the option to unlock parts of the content with a different set of passwords in a single shortcode. Complicated? Sure, but so the request for that feature was. The shortcode looks like this:

[passster password="123" partly="345" hide="true"]{partly}your hidden{partly} content[/passster]

A small explanation for that. Let’s image you type “123” then you will only see “content” as the result. Instead, if you type “345” then you would see “your hidden” as a result. That’s it pretty much.