Skip to content

Instantly share code, notes, and snippets.

@theukedge
Created September 14, 2013 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theukedge/6565735 to your computer and use it in GitHub Desktop.
Save theukedge/6565735 to your computer and use it in GitHub Desktop.
<?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