Hide video with Pay with a like

How can I hide a video with pay with a like? Then once the user likes my page, they get to view the video.

  • Timothy Bowers

    Do you refer to our video plugin?

    https://premium.wpmudev.org/project/unbranded-video-tutorials/

    You could use a shortcode then encase it within the Pay With A Like?

    If its some other video then you would need to put it within the shorcodes. I would presume you are using some plugin which makes use of HTML5 video tags or something like FlowPlayer? JWPlayer?

    Take care.

  • Hakan

    Hi Timothy,

    I talked to wptimo in the Live Chat. What he requires is using Pay With a Like for a video whose html code is generated by theme options.

    @wptimo,

    Pay With a Like is designed to modify, i.e. hide and reveal upon Like, post or page content. But, it is possible to adapt it to your case. What you need is copying video html code to a page and modify your template.

    To give an example let's suppose that there is a function "generate_homepage_video()" which outputs video html on the homepage. So your homepage template has a php code like this:

    <?php
    generate_homepage_video();
    ?>

    Let's assume that this function generates an html output like this:

    <iframe width="560" height="315" src="http://www.youtube.com/embed/-uiN9z5tqhg" frameborder="0" allowfullscreen></iframe>

    Now, please follow these steps:

    1. Create a new page and paste the above html code in the editor.
    2. Switch to HTML view and make the following changes:

    replace &gt";" with >
    replace &lt";" with <
    please ignore quotes, I put them because it is not displayed correctly otherwise.

    3. Enable Pay With a Like for the page
    4. Choose method "Selection Tool"
    5. Wrap the html content using Selection Tool icon. The result should be as seen in the attached screenshot.
    6. Save the page in draft mode. We are doing this, because we don't want the page to be displayed in page list. We are just interested in its content. BTW title of the page is not important.
    7. Write down the ID of the page which is revealed after save. In our example we assume it is 7.
    8. In Pay With a Like settings select yes for "Enable on the home page"
    9. Now edit your template which displays the video using the supposed generate_homepage_video() function:

    <?php
    if ( function_exists( 'wpmudev_pwal' ) ) {
         $post_id = 7;
         $page = get_post( $post_id );
         echo wpmudev_pwal( $page->post_content );
    }
    else
         generate_homepage_video();
    ?>

    Now Pay With a Like will protect the video if it is activated. If not, your video will be displayed as before.

    If any part is unclear, please do not hesitate to ask.

    Cheers,
    Hakan