Im using Pay Per View plugin shortcode inside the posts

Hello

Im using Pay Per View plugin shortcode inside the posts and Im having hard time achieving following.

I need to add a CSS class to a content displayed after the payment, content when hidden behind the plugin block / wall, has a css class of "ppw_form_container" and thats good, Im able to use it to style it the way I want.

But when the content is displayed, its displayed as it was written in the post, I need to wrap that content in a custom div class.

I tried modifying "return $this->clear($content);" in the plugin, but it wrapped the WHOLE POST in the div, while I need to wrap only a part of content in this div, the content which was hidden behind the plugin function.

Can you please help me with this?

Thank you.

  • Vaughan

    Hi @kaza,

    sorry for the delay on this.

    I'm not sure you can do this without custom coding the plugin itself.

    You can try adding the div round the content in the clear function()

    open pay-per-view.php

    find function clear (around lin 773)

    /**
    		* Try to clear remaining shortcodes
    		*
    		*/
    		function clear( $content ) {
    			// Don't even try to touch an object, just in case
    			if ( is_object( $content ) )
    			return $content;
    			else {
    				$content = preg_replace( '%\[ppw(.*?)\]%is', '', $content );
    				$content = preg_replace( '%\[\/ppw\]%is', '', $content );
    				return $content;
    			}
    		}

    replace with the following;

    /**
    		* Try to clear remaining shortcodes
    		*
    		*/
    		function clear( $content ) {
    			// Don't even try to touch an object, just in case
    			if ( is_object( $content ) )
    			return $content;
    			else {
    				$content = preg_replace( '%\[ppw(.*?)\]%is', '', $content );
    				$content = preg_replace( '%\[\/ppw\]%is', '', $content );
                    $content = '<div class="ppv-visible">' . $content . '</div>';
    				return $content;
    			}
    		}

    Hopefully that should then surround the content with a div class ppv-visible.

    Hope this helps.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.