Created
April 28, 2015 19:34
-
-
Save kylelarkin/52d704a7688e32275945 to your computer and use it in GitHub Desktop.
Custom WordPress Query
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 | |
// Setup the Arguments for the Custom Query | |
$args = array( | |
'post_type' => '' | |
); | |
// Create the Custom Query and save it as a variable | |
$the_query = new WP_Query( $args ); | |
// Loop through our Custom Query results | |
if ( $the_query->have_posts() ) : | |
while ( $the_query->have_posts() ) : $the_query->the_post(); ?> | |
<!-- Output Goes here --> | |
<?php endwhile; | |
// If we didn't find anything, let us know | |
else : | |
echo '<p>No quotes were found.</p>'; | |
endif; | |
// Rest the data so we don't break the default loop | |
wp_reset_postdata(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment