WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I need to display posts in a category on my page template. How can I do this? Thanks

share|improve this question
see this: wordpress.stackexchange.com/a/3667/19691 – atmon3r Aug 26 '12 at 9:41


Just take a look at the WordPress Template Hierarchy.


You'll find out that WordPress has three different types of templates, that you can use:

A) For built in taxonomies: Category & Tag

B) For custom taxonomies.

The template engine will search for such templates when you request a category/tag/custom taxonomy archive page.

  • taxonomy-{$taxonomy_slug}-{$term}.php
    • » taxonomy-{$taxonomy_slug}.php
    • » taxonomy.php
  • category-{$slug}.php
    • » category-{$id}.php
    • » category.php
  • tag-{$slug}.php
    • » tag-{$id}.php
    • » tag.php


Template Hierarchy by Chip Bennet

The excellent diagramm by our man Chip Bennet.

share|improve this answer

I'm reading this to say you want to add a list of category posts on a page view, not a single post view. That being the case I would first suggest looking at one of what I imagine are numerous plugins that can provide this functionality.

An example plugin would be BNS Featured Category* which provides a shortcode that should accomplish what you are looking to do.

Link: BNS Featured Category on WordPress Extend

*NB: Full disclosure, I wrote BNS Featured Category.

share|improve this answer

Try using child theme. Create a custom template and try the following code.

  Template Name: template name
<?php get_header();
        $recent = new WP_Query("category_name="categoryname"&posts_per_page=5"); 

        <?php the_content(); 


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.