Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $args = array(
  2. 'post_type' => 'hus',
  3. 'post_status' => 'publish',
  4. 'posts_per_page' => 10,
  5. );
  6.  
  7. $loop = new WP_Query( $args );
  8. $current_user_id = get_current_user_id();
  9. $acf_user = get_field( 'user' );
  10. ?>
  11. <div id="primary" class="content-area">
  12. <main id="main" class="site-main">
  13. <?php
  14.  
  15. if ( is_user_logged_in() && $current_user_id === $acf_user || current_user_can( 'administrator' ) ) {
  16. while ( $loop->have_posts() ) : $loop->the_post();
  17. the_title();
  18. the_content();
  19. print_r($post->ID);
  20. endwhile;
  21.  
  22. wp_reset_postdata();
  23. } else {
  24. echo "<span>Du har inte behörighet att visa denna sida.</span>";
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement