Created
March 7, 2012 22:18
-
-
Save malfborger/1996631 to your computer and use it in GitHub Desktop.
Wordpress: Custom query 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 $custom_query = new WP_Query('cat=-9'); // exclude category 9 | |
while($custom_query->have_posts()) : $custom_query->the_post(); ?> | |
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>"> | |
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> | |
<?php the_content(); ?> | |
</div> | |
<?php endwhile; ?> | |
<?php wp_reset_postdata(); // reset the query ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment