Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created August 3, 2022 19:38
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 greenhornet79/ff54cfa08e11faa794d64c88e8c21f07 to your computer and use it in GitHub Desktop.
Save greenhornet79/ff54cfa08e11faa794d64c88e8c21f07 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'leaky_paywall_nag_message_text', 'zeen_lp_nag_by_cat', 20, 2 );
function zeen_lp_nag_by_cat( $text, $post_id ) {
$cats = get_the_category( $post_id );
foreach( $cats as $cat ) {
if ( $cat->name == 'Blues' ) {
return 'For all the Blues content, please subscribe.';
} else if ( $cat->name == 'Jazz' ) {
return 'For all the Jazz content, please subscribe.';
}
}
return $text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment