Created
November 29, 2013 15:38
-
-
Save szbl/7707442 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ramdin_the_content( $content ) | |
{ | |
if ( is_user_logged_in() ) | |
return $content; | |
if ( 'product' == get_post_type() ) | |
{ | |
$content = 'Please <a href="' . esc_url( site_url( '/wp-login.php' ) ) . '">login to view this product</a>.'; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'ramdin_the_content' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment