Select/filter individual custom post types for Pay Per View

Pay Per View seems perfect to use alongside Protected Content to allow non-members to pay for post access. However we have several custom post types, only one of which we want to protect.

Is there any way to filter the plugin to protect only a single (or multiple) custom post types and not others? In the plugin options it is either all cpts or none. This is way too broad of an option.

While the site editors can assign the pay-per-view settings on a post-by-post basis, it would be much simpler to be able to assign Pay Per View protection to all posts of a particular custom post type - is there any way to do this?

Also, none of our content creators use the Text Editor - the Visual Editor is disabled - so we cannot generate shortcodes on any post edit screen. How are the shortcodes generated for each post? As an alternative to using a global cpt setting, I could add conditional shortcodes them to my templates via php <?php echo do_shortcode('[shortcode_goes_here]'); ?> so these posts are protected automatically.

I could not find any information on shortcodes for PPV on the Usage page. Please advise.

  • Patrick

    Hi there @joshuaiz

    I hope you're well today!

    Pay Per View shortcodes are only required if you want to protect portions of post content. However, each shortcode has a unique, randomly-generated, identifier like so:
    [ppw id=&quot;100674755&quot; description=&quot;Description here&quot; price=&quot;10.00&quot;]Protected content here[/ppw]

    But it looks like you can give each instance of the shortcode you use your own unique identifier, as long as it contains 9 digits. I just tested that in a sandbox and it worked, yay!

    If you want to protect the whole post of a certain custom post type, set Protection for custom post types to Disabled for all custom post types in the plugin settings. The use the options in the metabox in each post to override that general setting (screenshot).

    And yes, of course, you can use do_shortcode in your templates as long as the content is properly concatenated. If the content is all HTML, no need to concatenate. :slight_smile:

  • joshuaiz

    Hi Patrick,

    Ideally I want to protect *all* posts of a single custom post type. There is no way to filter the plugin to do this?

    The content is not concatenated if that means it is purely html. It is grabbing posts using WP functions (php). I saw in the guide how to do that using template tags but I thought maybe when using shortcodes you don't have to concatenate the html.

    This won't work then on a theme template page as the posts are grabbed dynamically.

    Thus I don't think this plugin will work as-is. I'll have to look for another solution.

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.