This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function restrict_post_content_form_1($content) { | |
if( get_post_meta( get_the_ID(), 'protected', true ) == 'yes' && !is_user_logged_in() && !isset( $_COOKIE['form-1-complete'] ) ) { | |
return gravity_form(1, false, false, false) . '<p>This article is only available to subscribers to our newsletter. You may subscribe using the form above.</p>'; | |
} | |
else { | |
return $content; | |
} | |
} | |
add_filter( 'the_content', 'restrict_post_content_form_1' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment