Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( have_posts() ) : while ( have_posts() ) : the_post();
- $private = get_post_custom_values("private");
- if (isset($private[0]) && $private == "true") {
- if ( current_user_can( 'administrator' ) ) {
- the_title();
- the_content();
- } else if ( current_user_can( 'subscriber' ) ) {
- the_title();
- the_content();
- } else { // text to show instead the post
- echo 'this post is private';
- }
- } else { // this is visible to all
- the_title();
- the_content();
- }
- endwhile;
- endif;
- ?>
Add Comment
Please, Sign In to add comment