WordPress Template Hierarchy

1,701 views

Published on

Presentation from WordCamp NYC 2012

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

No Downloads
Views
Total views
1,701
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
25
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

WordPress Template Hierarchy

  1. 1. BEFORE: ONE UNIVERSAL LAYOUTBasic site wireframe: • Header • Navigation • Content • Sidebar • Footer
  2. 2. Unique andcustomizable layouts(WP for a blog)Automatic templaterendering(WP as a CMS)
  3. 3. WHY IS THIS GOOD FOR BLOGS?•  Be creative with layouts•  Design different layouts for different purposes•  Give visitors more points of entry
  4. 4. WHY IS IT GOOD FOR CMS SITES?•  Create different designs for each of your static pages•  Design templates will be applied automatically
  5. 5. index.phpstyles.css
  6. 6. WP Managed pagesWP Assisted pagesStatic Pages
  7. 7. if (is_home()) { Do something}
  8. 8. •  Easier to understand•  Easier to manage
  9. 9. Category ‘Foo’, ID 41.  category-foo.php2.  category-4.php3.  category.php4.  archive.php5.  index.php
  10. 10. JUST A FEW HIERARCHY PAGES404.php home.phparchive.php index.phpattachment.php page.phpauthor.php search.phpcategory.php searchform.phpcomments.php sidebar.phpdate.php single.phpfooter.php single-custom.phpfront-page.php tag.phpfunctions.php taxonomy.php
  11. 11. page-{slug}.phpcategory-{name}.phpauthor-{name}.php
  12. 12. RESOURCESWordPress Codex:http://codex.wordpress.org/Template_Hierarchyhttp://codex.wordpress.org/Theme_Development#Query-based_Template_FilesDigging Into WordPress (Chris Coyier and Jeff Starr)http://digwp.com/2010/09/wordpress-3-template-hierarchy/WP Tuts +http://wp.tutsplus.com/tutorials/the-wordpress-theme-files-execution-hierarchy/This Presentation:http://bit.ly/WPThierarchy

×