Template hierarchy -WordCamp Columbus

2,376 views

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,376
On SlideShare
0
From Embeds
0
Number of Embeds
123
Actions
Shares
0
Downloads
17
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Template hierarchy -WordCamp Columbus

  1. 1. July 14WordCamp ColumbusWordPress Template HierarchyPresented by Al Davis- WPTeach.com
  2. 2. WordCamp Developers Toronto WordPress DevelopersWho’s Toronto TELUS SMB ‘Portal God’ Althe bald Freelance Developer Davi s WordCamp Torontoguy? Owner-wpteach.com Toronto WordPress College Professor Meetup Intro to WordPress Intro to WordPress Theme and Plugin Development
  3. 3. The What file(s) does WordPress use when itQuestion displays a certain type of page?
  4. 4. TheAnswer?
  5. 5. header.phpLets sidebar.phpstart withthe The Loopbasics footer.php
  6. 6. Aworking index.php + style.css =theme A very basic but functional themeneeds:
  7. 7. So whatis with allof thisthen? A: Different looks for different types of content
  8. 8. Home Page Display Rules 1 home.php 2 index.php
  9. 9. 1 front-page.php This is used for displaying your latest posts or a static page as defined in Settings > Reading 2Front or Home page Page Display Rules When you set the Front page in Settings> Reading 3 Home Page Display Rules When posts page is set in the Front Page displays section of Settings> Reading
  10. 10. 1 Custom Template File The page template assigned to the page <?php /* Template Name: Whatever you call your template*/ ?> 2 page-{slug}.php if you use the slug “ bananas” WordPress will look for page- bananas.phpPage Display Rules 3 page-{id}.php if the page ID is 4, Wordpress looks to use page-4.php 4 page.php 5 index.php
  11. 11. Singular Page 1 Single Post Page 2 Static page
  12. 12. 1 Attachment postSinglular page Single post 2 Custom Post 3 Blog post
  13. 13. MIME-type.php 1 It can be any MIME type ( video.php, image.php, etc) for text/plain in order: 3.text.php 4.plain.php 5.text_plain.phpSingular Post 2 attachment.phpSingle Post- Attachment 3 single-attachment.php 4 single.php 5 index.php
  14. 14. 1 single-{posttype}.php if post type was “movies”, WordPress would look for single-movies.php Singular PostSingle Post- Custom Post 2 single.php 3 index.php
  15. 15. 1 single-post.phpSingular PostSingle Post- Blog Post 2 single.php 3 index.php
  16. 16. 1 Custom Template File The page template assigned to the page <?php /* Template Name: Whatever you call your template*/ ?> 2 page-{slug}.php if you use the slug “ bananas” WordPress will look for page- bananas.phpSingular Page Static page- aka 3 page-{id}.php if the page ID is 4, Wordpress looks to use page-4.php“ Page Display Rules” 4 page.php 5 index.php
  17. 17. 1 Post Pages Category Pages Tag Pages Custom Post TypesArchive Pages 2 Author Pages 3 Date Pages
  18. 18. ategory Pages Pages Tag 1 Date Pages Author Pages 1 category-{slug}.php 1 tag-{slug}.php 1 author-{nicename}.php 1 date.php 2 category-{id}.php 2 tag-{id}.php 2 author-{id}.php 2 archive.php 3 category.php 3 tag.php 3 author.php 3 index.php 4 archive.php 4 archive.php 4 archive.php 5 index.php 5 index.php 5 index.php Custom Post Type Pages 1 archive-{post-type}.php 2 archive.php 3 index.php
  19. 19. 1 Category Pages from Tag PagesWhy learn this? 2 Category from Category 3Differentiate Content Types Category from Pages 4 Pages
  20. 20. Questions?
  21. 21. THANKS Contact Email- al@wpteach.com Twitter- @adavis3105 FOR YOUR ATTENTION

×