Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This may be a really simple question but I've struggled to find an answer either searching here, WP forum or via Google.

I have a number of different categories and I would like to use just category.php. At the moment I have to create a thecatname-category.php page for each category but this is not very efficient as my I would have to create a new one every time a new Category was created.

So I need to find a workable solution that will display all posts from a selected Category where the category ID is passed to category.php and then display posts from that Category.

Hope that makes sense!

Thanks,

Kev

share|improve this question
    
category.php already uses the category ID; what is different in your idea? what is not working for you when you use the 'normal' category.php? –  Michael Jan 28 at 18:20
    
Thanks for your help, I found an answer here: wpbeginner.com/wp-themes/… –  Kev Jan 30 at 12:45

1 Answer 1

Wordpress uses the following hierarchy to determine which file should be used to display the category page:

  1. category-slug.php
  2. category-ID.php
  3. category.php
  4. archive.php
  5. index.php

Removing all of the "category-slug.php" and "category-ID.php" files whilst leaving just one file called "category.php" should do the trick.

http://codex.wordpress.org/Category_Templates

share|improve this answer
    
Thanks for your help. –  Kev Jan 30 at 12:46

Your Answer

 
discard

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.