Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Template Hierarchy

Post Formats Taxonomy?

Is post format really treated like a taxonomy? Because I can't get /post-format/link (or post_format/link) to render anything other than 404.


Yes, but somewhat unintuitively for developers, the slug is like /type/link/. Note that that will give a 404 unless you actually have some posts of that format. See also ticket 16149.
-Jdgrimes 12:53, 15 July 2014 (UTC)

wp-blog-header.php

I just learned that the file that controls this hierarchy is in the wp-blog-header.php. Is that right? Should we give a mention of this in the article so people can check or change...maybe not. This might open up a can of worms. Lorelle 22:09, 9 Mar 2005 (UTC)

Hm. That sounds more like developer documentation than user documentation to me. It's also more involved than just wp-blog-header.php. I think we can/should let this slide for now. Other opinions welcome. --MDAWaffe - Talk 21:34, 12 Mar 2005 (UTC)

home.php and index.php

I don't understand the difference between home.php and index.php - when is the index.php used and when is the home.php used? can i put a link on the home.php template to go to the index.php template? for e.g., that way i can have a front page with some constant "intro" text and headlines of recent posts, and a seperate "blog" (or news) page with full posts as usual. This is very useful for commercially oriented sites. --User RanH 15:23, 3 Apr 2005 (UTC)

home.php is used to display the main page, if the file exists. If home.php does not exist, index.php is used. To do what you describe, you might look at Pages#Using a Page as the Front Page. I have not tried this myself. --MDAWaffe - Talk 18:39, 3 Apr 2005 (UTC)

Tahnks - its not exactly what i needed but it got me on the right track :) --User RanH

No index.php breaks theme.

I'm using WordPress 2.0.1, and if I remove the index.php from my theme (but still have a functional home.php), the Theme Editor says my theme is broken. The instructions for the template hierarchy seem to conflict with the instructions for themes, which state that at a minimum, a theme must have an index.php and a style.css. --PeterWood 04:32, 4 Feb 2006 (GMT)

ERROR attachment.php

I think the that if the template attachment.php is not there, the next used is single.php Should I correct it in the Article ? -- User:Jmini

User:Jmini - Not sure what is correct--I'll see if I can find someone to look. Thanks for your comments. --MichaelH (talk) 00:21, 13 October 2008 (UTC)

Attached diagram is misleading

Unless I'm misunderstanding something, I think the attached diagram of the template hierarchy is out of date--specifically, the part about pagename.php. Looking at the detail of the template hierarchy (http://codex.wordpress.org/Template_Hierarchy#The_Template_Hierarchy_In_Detail) I no longer see a mention of pagename.php. It appears to have been replaced by page-{slug}.php.