Skip to content

Instantly share code, notes, and snippets.

Last active Dec 18, 2015
What would you like to do?
Just a simple query put together using WP_Query. I used this on a site to list out course materials (custom post type) to the currently logged-in user. The user will only see courses that they have the capability to see. This is used in Conjunction with Jigoshop and the Groups/Subscriptions plugin from Itthinx.
$args = array(
'post_type' => 'courses',
'perm' => 'readable',
'order' => 'DESC',
'orderby' => 'title',
'posts_per_page' => -1
$course_posts = new WP_Query($args);
if($course_posts->have_posts()) :
while($course_posts->have_posts()) :
<ul class="display-posts-listing">
<li class="listing-item"><a href="<?php echo get_permalink( ); ?>" title="<?php the_title() ?>"><?php the_title() ?></a></li>
Oops, there are no posts.
// Reset Post Data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment