Skip to content

Instantly share code, notes, and snippets.

@theukedge
Created September 14, 2013 17:28
Show Gist options
  • Save theukedge/6563869 to your computer and use it in GitHub Desktop.
Save theukedge/6563869 to your computer and use it in GitHub Desktop.
<?php
// FILTER POST CONTENT FOR PARDOT
function filter_post_content_pardot($content) {
if( get_post_meta( get_the_ID(), 'pardot_protected', true ) == 'protected' && !is_user_logged_in() && !isset( $_COOKIE['email-to-pardot'] ) ) {
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', 'filter_post_content_pardot' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment