Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to make a template for all posts in a custom post type? For example I would like to be able to change an adsense ad or some other element on every post by simply editing a custom template.

I have been experimenting with templates that are pretty static, but I am stumped on which one to copy/edit for the posts.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Yes it possible, take a look at Template Hierarchy codex entry to get a better idea but the simple answer is to create a template for all of you custom post type posts create a template and name it single-{post_type}.php so if your post type is named dogs then your template file should be named single-dogs.php and automatically this template file will be used to display all of the dogs post type posts and once you edit that file it will effect all of the posts of that type.

share|improve this answer
    
Wow fantastic... that was fast :D It's amazing how much information is in the Codex, and yet I consistently fail at finding it :) –  SkinnyGeek1010 Mar 31 '11 at 0:44
add comment

This image is invaluable; make sure you print it out and keep it around your desk:

http://codex.wordpress.org/images/thumb/1/18/Template_Hierarchy.png/750px-Template_Hierarchy.png

share|improve this answer
add comment

Your Answer

 
discard

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.