Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2013 21:19
What would you like to do?
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