0

I came up with this in the codex in order to set my template for a specific category post.

I have a category name called "Work". The slug for this category is "work". I created a "category-work.php" file, and yet, the post still defaults to the index.php.

I am trying to access the post itself.

What am I missing?

3
  • Some simple troubleshooting you could do: Place the category-work.php file in the root of your theme and not in a sub folder Try to create a file with the ID i.e category-56.php and see if that pulls back the contents of the php file Also just to cover the basics you mention "the post still defaults to index.php" which implies you're not actually viewing the category archive page i.e. www.example.com/category/work and infact looking at an individual post which will bypass the category template and default to single.php or index.php depending on your theme Commented May 12, 2014 at 21:10
  • Also, a plugin could conceivably interfering. Have you tried disabling all plugins?
    – Pat J
    Commented May 12, 2014 at 21:28
  • The problem was that I was accesing www.example.com/work and not www.example.com/category/work. Can you put that as an answer so I can accept it, Pat?
    – Dynelight
    Commented May 13, 2014 at 17:52

1 Answer 1

0

Your title makes me wonder if you are using a Custom Post Type. If that is the case WordPress may be looking for a template for the Custom Post Type archive instead of the category.

Check out Post Type Templates to see if that helps a bit. If you need a certain category inside a specific post type let me know and I will dig that up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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