Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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