Support » Plugin: WooCommerce Pay Per Post » Partial access to custom post

  • Resolved Manish

    (@nims)


    I need to have a custom post or a regular post where I need to show part of it to all – like a description of a service or product and want to hide the contact details of the seller. Details of the seller needs to be shown to the people who make payment to buy that post.
    Can it be done using this plugin ?

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Manish,
    Yes this would be possible but you would have to create a custom page template for your custom post type and utilize the template tags to block off customer only data.

    TEMPLATE FUNCTIONS
    Out of the box this plugin will work with any theme which uses the standard WordPress function the_content() for those themes that do not utilize the_content() you can use the following static functions in your templates.

    Woocommerce_Pay_Per_Post_Helper::has_access()
    This checks if the current user has access to the page. It returns true/false

    Woocommerce_Pay_Per_Post_Helper::get_no_access_content()
    This returns the content specified in the PPP Options.

    And example of this working together would be something like the following
    <?php if(Woocommerce_Pay_Per_Post_Helper::has_access()): ?>
    This is the content that a user should see if they paid for the post
    <?php else: ?>
    <?php echo Woocommerce_Pay_Per_Post_Helper::get_no_access_content(); ?>
    <?php endif; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Partial access to custom post’ is closed to new replies.