Last active
August 29, 2015 14:19
-
-
Save digisavvy/784395c5b8ddfff8eb13 to your computer and use it in GitHub Desktop.
WP Query to display posts current user has capabilities to see
This file contains 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 | |
$args = array( | |
'post_type' => 'course', | |
'perm' => 'readable', | |
'order' => 'ASC', | |
'orderby' => 'title', | |
'posts_per_page' => -1, | |
'READ_ACCESS' => 'read_access', | |
'post__not_in' => array( 1271 ) | |
); | |
$course_posts = new WP_Query($args); | |
if($course_posts->have_posts()) : | |
while($course_posts->have_posts()) : | |
$course_posts->the_post(); | |
?> | |
<li><a href="<?php echo get_permalink( ); ?>" title="<?php the_title() ?>"><?php the_title() ?></a></li> | |
<?php | |
endwhile; | |
else: | |
?> | |
// Oops, there are no posts. | |
<?php | |
endif; | |
// Reset Post Data | |
wp_reset_postdata(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment