msrougi

Bloquear acesso para não assinantes/não admins V.2

Apr 7th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. if ( have_posts() ) :
  3. while ( have_posts() ) : the_post();
  4. $private = get_post_custom_values( 'private' );
  5. if ( isset($private[0]) && $private == 'true' ) {
  6.  
  7. if ( current_user_can('subscriber') || current_user_can('administrator') ) {
  8. the_title();
  9. the_content();
  10. }
  11.  
  12. } else { // this is visible to all
  13. echo 'O conteúdo desta página é privado.';
  14. }
  15.  
  16. endwhile;
  17. endif;
  18. ?>
Add Comment
Please, Sign In to add comment