Limit list of post titles to single catgegory?
-
I’m using this code on a custom template to display a list of post titles:
<ul class="category-list"> <?php // we add this, to show all posts in our // Glossary sorted alphabetically $args = array( 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC' ); $glossaryposts = get_posts( $args ); // here comes The Loop! foreach( $glossaryposts as $post ) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul>
This works nicely, however I want to limit my list to a certain category. I’ve found other solutions for doing this, but not one that works with the code I currently have. How can I modify this to limit my list to a specific category?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Limit list of post titles to single catgegory?’ is closed to new replies.