Skip to content

Instantly share code, notes, and snippets.

@teolopez
Created July 23, 2013 06:43
Show Gist options
  • Save teolopez/6060300 to your computer and use it in GitHub Desktop.
Save teolopez/6060300 to your computer and use it in GitHub Desktop.
victor - use the force i mean this loop =)
<?php
// The Query
$args = array(
'post_type' => 'my_custom_post_type',
'order' => 'DESC', // DESC or ASC
'posts_per_page' => -1,
// Call custom taxonomy
/*'tax_query' => array(
array(
'taxonomy' => 'people',
'field' => 'slug',
'terms' => 'bob'
)
) */
);
$custom_query = new WP_Query( $args );
// The Loop
if ( $custom_query->have_posts() ) { while ( $custom_query->have_posts() ) { $custom_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php } } else { ?>
<h3> no posts found </h3>
<?php } /* Restore original Post Data */ wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment