Created
June 24, 2012 18:18
-
-
Save dmtintner/2984291 to your computer and use it in GitHub Desktop.
Perfect wp_query usage
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
$my_query = null; | |
$my_query = new WP_Query($args); | |
if( $my_query->have_posts() ) { | |
while ($my_query->have_posts()) : $my_query->the_post(); ?> | |
<div class="faculty-post"> | |
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3> | |
</div><!-- closes .faculty-post --> | |
<div class="clear"></div> | |
<?php endwhile; | |
} //faculty post loop ends?> | |
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment