Created
July 23, 2013 06:43
-
-
Save teolopez/6060300 to your computer and use it in GitHub Desktop.
victor - use the force i mean this loop =)
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 | |
// 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