WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hay, i have a custom post type "Events", however this is basically a post type, so it inherits the post.php template page.

Is there anyway to use a different template (i.e events.php) if the content type is an 'event'?

share|improve this question
up vote 9 down vote accepted

Try single-events.php.

See Template Hierarchy in Codex for full scheme of templates.

share|improve this answer
Works a charm, I'm only getting used to how WordPress works, i honestly didn't know it was this flexible! – dotty Oct 6 '10 at 11:03
Yep, templates are extremely flexible system. Just be aware that some frameworks (like Hybrid) apply their own template hierarchy, defaults are not set in stone. – Rarst Oct 6 '10 at 11:12

This is why using the custom template files that you can use like page-{post_type}.php and single-{post_type}.php are extremely handy. And in 3,1, archive-{post_type}.php too.

So yea, you just create a template file for your post types, using the custom templates like that instead of the way where you put the template name in a comment at the top of the file. That way sucks, and I never ever use it, and I create post types like maddness.

share|improve this answer
I read about single-{post_type}.php and archive-{post_type}.php in codex. Couldn't find a reference for page-{post_type}.php Are you sure about this? Can you share some reference? – afnrf Nov 4 '11 at 9:46
It's part of page templates. Read about the template hierarchy here: codex.wordpress.org/Template_Hierarchy – jaredwilli Nov 15 '11 at 4:40

Your Answer


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.