Bear with me as i try to learn WP.

Lets say we have a 3rd party theme were the route of the request is somehow like this.

Root theme index.php diverts to a nother php file which decides what page to go next depending on the themes settings.

then it gets diverted to a master page that handles all kind of pages (posts,pages,archives) using logic within this file.

And now Native WordPress comes and says for example that you can just create a category-{slug}.php file and use it.

It seems to work this way if i put a simple category-{slug}.php in my themes ROOT directory.

So is this how everything is working in WP? I can make a child theme for my paid theme and go inside and everything that codex says?

Maybe i am not well understood , but if someone "catches" my thinking , i would appreciate a shed of light.

1 Answer 1


Do not rely on the codex. Some pages are just a heap of crap and totally useless. The problem with the codex is that everybody with an account on wordpress.org can change and alter the codex as they see fit.

I don't say, Do not use the codex, I'm saying that you need to be cautious. You need to read the codex in conjuction with the actual source code. Some pages are very well written and clear with many good examples of usage.

The way I read your question, you are hinting on the Template Hierarchy. This is one of the most important section as this is how Wordpress decides which template to serve up according to the URL been served. These templates are the recommended ones and any template naming convention outside this hierarchy won't work out of the box. Also, any naming convention that creates conflict with these set hierarchy will be ignored and will fail.

There are filters like template_include and single-template which will allow you to set a custom template which is outside normal hierarchy rules according to your needs. For example, if you need a custom template for the single posts of a specific category, you can create a file called single-cat.php and then use the single_template filter to tell Wordpress to use this template whenever a single post is from this specific category


From comments, it is really easy to create any template in your theme. index.php can used as a base for any template. You just need to make a copy of index.php and rename it to what is needed

For eaxample, if your theme don't have a category.php, you can simply copy index.php and rename it to category.php

  • Quite there. In the hierarchy says about front-page.php. there is no such page anywhere in my WP installation. Instead there is an index.php in all themes root dir...This is the starting point?
    – e4rthdog
    Feb 10, 2015 at 7:02
  • 2
    @e4rthdog from Template Hierarchy: "With the exception of the basic index.php template file, Theme developers can choose whether they want to implement a particular template file or not. If WordPress cannot find a template file with a matching name, it skips down to the next file name in the hierarchy. If WordPress cannot find any matching template file, index.php (the Theme's home page template file) will be used." index.php is the only required template for a valid theme, all others are optional.
    – Milo
    Feb 10, 2015 at 7:05
  • front-page.php is a page you have to create if needed. This template is very rarely included in themes. This template is used when you set a static front page. Usually most people will just use page.php or any custom page template Feb 10, 2015 at 7:07
  • 1
    @Milo thanks for that extra info. You should actually post that as a separate answer :-) Feb 10, 2015 at 7:09
  • 1
    Just a tip, to create any template in a theme, simply copy your index.php and rename it accordingly. If your theme does not have a front-page.php, copy index.php and rename it front-page.php. Thats all Feb 10, 2015 at 7:20

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.