Created
December 18, 2015 01:20
-
-
Save LukeMichaels/1a778554a7d00f602172 to your computer and use it in GitHub Desktop.
Loop posts from specific category
'cat' => 18 // the category ID #
'showposts' => 16 // the # of posts to display
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
/* remove `post_type` if not using a custom post type */ | |
<?php query_posts( array( 'post_type' => 'your_category_title', 'cat' => 18, 'showposts' => 16 ) ); | |
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
<h2><?php echo $post->post_title; ?></h2> | |
<p><?php the_content(); ?></p> | |
<a href="<?php echo get_permalink($post->ID); ?>">link</a> | |
<?php endwhile; endif; wp_reset_query(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment