Brett
Brett

Reputation: 887

Wordpress Page Hierarchy

I have the following page on a site in development:

http://telamon.com.s137737.gridserver.com/media/press/

I want to do some stuff outside the loop, so I created page-press.php based on my understanding of the WP page hierarchy (http://codex.wordpress.org/Template_Hierarchy). It isn't working. I've reset permalinks as well. This isn't the first time I've had problems here and I just ended up creating a template, but this should work shouldn't it?

Upvotes: 0

Views: 342

Answers (1)

Krycke
Krycke

Reputation: 3186

Yes it is true that the hierarchy should work like that, but for it to work you need the following to be true:

  1. It needs to be in the Single mood
  2. The page need to be a static page
  3. You can't apply any other custom template on the page
  4. The slug of the page needs to be "press"

If all of these are true, then it should work. If not, then check the following, find the id of the page and create a page-$ID.php and check if that works. See if you end up in the page.php template file, or if you end up in index.php try to use var_dump on a few variables like is_single() and so on.

EDIT:

Single mood is when the page is listed by it's own, not in a list.
Static page means this is not a post, or a list view like archive or something like that
Custom template is when you create a page to be a specific "page template" available to choose from, when you edit you page (down right).
Slug is not the same as your title, nor you id. It's most likely a url friendly variation of your title.

Upvotes: 1

Related Questions