WordPress Pay Per Post Plugin (CMPPP) - How To - Display Purchase Info and Button For Each Post (Shortcodes)


Displaying Purchase Info and Button For Each Post

Back to User Guide

TIP: What Are Shortcodes

Shortcodes add dynamic content to your site via a small piece of code.

Learn more: Shortcodes - How To Use | Finding ID of Post/Page/Other Content

What is This Feature

The WordPress Pay Per Post plugin version 2.6.8 introduced 2 new shortcodes which allow to display the purchase information (price and duration) and a button for the needed post in any place on your site.

Note: These shortcodes show only the information about the individual price of the shortcode.

Setting up individual price for a post - Pay-Per-Post Plugin
Setting up individual price for a post

Shortcodes

There are 2 shortcodes:

  • [cmppp-single-price-value] - This shortcode shows the information about the restricted post - price and duration of how long the post will be unlocked after the payment.
  • [cmppp-single-price-buy-button] - This shortcode shows the button that redirects the user to the cart for purchasing the access to the post. This button can also show the price and duration of the restricted post.

Each shortcode has a few parameters, let's consider them.

Single Price Value Shortcode

The shortcode [cmppp-single-price-value] has the following parameters:

  • postid - This parameter should contain the post ID to show the relevant information. The shortcode must contain this parameter. Example: postid="27461".
  • label - This parameter allows to override the global message defined in the plugin settings. This parameter accepts 2 placeholders:
    • %price% - to show the price of the post.
    • %period% - to show the duration of the unlock period.

      Example: label="Price: %price% for %period%".

Single Price Buy Button Shortcode

The shortcode [cmppp-single-price-buy-button] has the following parameters:

  • postid - This parameter should contain the post ID to show the relevant information. The shortcode must contain this parameter. Example: postid="27461".
  • label - This parameter allows to override the button text defined in the plugin settings. This parameter accepts 2 placeholders:
    • %price% - to show the price of the post.
    • %period% - to show the duration of the unlock period.

      Example: label="Price: %price% for %period%".

  • guest_not_allow_label - If guest users are not allowed to purchase access to content, they will see a relevant message instead of the buy button. This parameter allows to override the message defined in the plugin settings. Example: guest_not_allow_label="Please, login first".
  • show_paid_label - If the user has already purchased the access to the post, this parameter allows to show the relevant message instead of the buy button. The message is defined in the plugin settings. Set "1" to enable, and "0" to disable. Default value is "0". Example: show_paid_label="1".
  • paid_label - This parameter allows to override the message about purchased post defined in the plugin settings. Example: paid_label="Purchased".

Global Labels

To define the labels mentioned above, navigate to Admin Dashboard → CM Pay Per Posts Pro → Settings → Labels tab.

Navigation to the plugin labels - WordPress Paywall Plugin
Navigation to the plugin labels

Needed shortcodes can be found under the section Shortcode. There are 3 labels:

Labels - Paywall Plugin WordPress
Labels
  • shortcode_single_price_buy_button - The label for buy button of the individual price form. Placeholders: %price%%period%. Used for the shortcode [cmppp-single-price-buy-button]
  • shortcode_single_price_buy_button_purchased - The label for buy button of the individual price form when the post is paid. Placeholders: %price%%period%. Used for the shortcode [cmppp-single-price-buy-button]
  • shortcode_single_price_value - The label for individual price value. Placeholders: %price%%period%. Used for the shortcode [cmppp-single-price-value]

Using Shortcodes

Let's add to the page both shortcodes with parameters:

Adding shortcodes to the page - Best Paywall Plugin for WordPress
Adding shortcodes to the page

Here's how it looks like on the front-end:

Front-end example for logged-in users - WordPress Plugin Paywall
Front-end example for logged-in users

And here's how it looks like for guest users if they're not allowed to purchase access:

Front-end example for non logged-in users - Paywalled Content
Front-end example for non logged-in users

How To Use It?

You can use these shortcodes to build a content catalog. You can embed them into custom pages and apply the appearance to fit to your site style using CSS.

Here's an example of the result can look like:

Usage example - Paywall Solutions for Publishers
Usage example

More information about the WordPress Pay Per Post Plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.