I was trying to find a way to filter my custom post types by category in the admin view and was having difficulty learning how to do it. After a ton of searching I found a great snippet of code to achieve this. The only drawback is you cannot use […]
The following snippet will get the posts of a specific category. So if you wanted to have a page that just shows posts of a certain category this would do it .
<?php query_posts('cat=5&showposts=10'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title() ?>"<?php the_title() ?>></a>
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
<p class="read-more"><a href="<?php the_permalink() ?>">Read More</a></p>
In this example we are going to get posts from the category with an ID of “5” […]
The following snippet will display the categories in a list for the post.
<?php the_category(', '); ?>
The comma in the parenthesis separates each category with a comma.