SlideShare a Scribd company logo
Wordpress Template
    Hierarchy
     Keith Lockhart
Topics

•   Base Templates - Yoast

    Worpress Template Hierarchy
•   Tips and Tricks

    Wordpress on the Mac - if we have time...
Wordpress Theme
               Anatomy blog works
    Cheat sheet for how your

•   Wordpress themes are made up of a folder
    of template files, each of which controls a
    specific piece of your theme.

    Every page has header, sidebar and footer
    files.
•   You can alter the files so that they show
    specific data depending on the page you are
    on.
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Wordpress template hierarchy
Deprecated
Template Files Within Template
             Files
•   You have seen how WordPress includes standard
    template files (header, footer, and sidebar) within the
    index.php template file. You can also include other
    template files within any of your template files.

    For example, sidebar.php might contain a template
    file that generates a search form — searchform.php.
    Because this is not one of WordPress's standard
    template files, the code to include it is a little
    different:

•   <?php get_search_form(); ?>

    We should no longer be using include and
    TEMPLATEPATH to get our search forms into themes
    as WordPress supplies the above template tag.
•   Most WordPress Themes include a variety of
    template files within other templates to generate
      Template Files - index.php
    the web pages on the site. The following template
    files are typical for the main template (index.php) of
    a WordPress site:

    header.php

•   theloop.php (The Content)

•   wp-comments.php

    sidebar.php

•   searchform.php

•   footer.php

    However, this structure can be changed. For instance,
    you could put the search form in your header.
    Perhaps your design does not need a footer, so you
    could leave that template out entirely.
Special Template Files


•   WordPress features two core page views of web
    pages in a WordPress site. The single post view is
    used when the web pages displays a single post. The
    multi-post view lists multiple posts or post summaries,
    and applies to category archives, date archives,
    author archives, and (usually) the "normal" view of
    your blog's home page. You can use the index.php
    template file to generate all of these types of pages
    or rely on WordPress' template hierarchy to choose
    different template files depending on the situation.
What template file will Wordpress use?
 •   What template file will WordPress use when a certain type
     of page is displayed?

     WordPress automatically recognizes template files with
     certain standard names and uses them for certain types of
     web pages. For example, when a user clicks on the title of a
     blog post, WordPress knows that they want to view just that
     article on its own web page. The WordPress
     template hierarchy will use the single.php template file
     rather than index.php to generate the page — if your Theme
     has a single.php file. Similarly, if the user clicks on a link for
     a particular category, WordPress will use the category.php
     template if it exists; if it doesn't, it looks for archive.php,
     and if that template is also missing, WordPress will go ahead
     and use the main index.php template. You can even make
     special template files for specific categories (see
     Category Templates for more information).
one and ending in the other.

    •
                 Template File Tips
        Eg. the html and body HTML elements typically begin in
        header.php and end in footer.php. Most WordPress themes
        make use of HTML div elements, which can also span
        several files. For instance, the main div for the page
        content might start in header.php and end in either
        index.php or single.php.

    •   Tracking down where an HTML element begins and ends
        can get complicated if you are
        developing, designing, or modifying a Theme. Use comments
        to note in the template files where a large container tag
        opens and where it closes so you can track which div is
        which at the end of different sections.

•   WordPress automatically recognizes template files with
    certain standard names and uses them for certain types of
    web pages. For example, when a user clicks on the title of a
    blog post, WordPress knows that they want to view just that
    article on its own web page. The WordPress
    template hierarchy will use the single.php template file
    rather than index.php to generate the page — if your Theme
    has a single.php file. Similarly, if the user clicks on a link for
    a particular category, WordPress will use the category.php
Tracking Opening and Closing Tags

•   Tracking down where an HTML element begins and
    ends can get complicated if you are
    developing, designing, or modifying a Theme. Use
    comments to note in the template files where a large
    container tag opens and where it closes so you can
    track which div is which at the end of different
    sections.

•   WordPress automatically recognizes template files
    with certain standard names and uses them for
    certain types of web pages. For example, when a user
    clicks on the title of a blog post, WordPress knows
    that they want to view just that article on its own
    web page.
Tracking Opening and Closing Tags
    The WordPress template hierarchy will use the
    single.php template file rather than index.php to
    generate the page — if your Theme has a single.php
    file.
•   Similarly, if the user clicks on a link for a
    particular category, WordPress will use the
    category.php template if it exists; if it doesn't, it
    looks for archive.php, and if that template is also
    missing, WordPress will go ahead and use the main
    index.php template.
•   You can even make special template files for
    specific categories (see Category Templates for
    more information).
Test Template Files Under Different
              Views



If you have made changes to the comments,
sidebar, search form, or any other template
file, make sure you test them using different
web page views (single post, different types
of archives, and pages).
Comment Deviations
•   If you are
    designing Themes for public release, keep in
    mind that someone who downloads your Theme
    will probably want to modify it slightly for
    their own use. So, it is helpful if you make
    notes in your template files where you have
    made changes from the logic of the Default
    and/or Classic Themes. It is also a good idea
    to add comments in your Theme's main style
    file if you have style information elsewhere
    (such as in your header.php file or in HTML
    tags).
Close the Tag Door Behind You

•   If you start a HTML tag or div in one template
    file and don't close it there, make sure you
    include the closing tag in another template file.
•   The WordPress Forum gets a lot of questions
    about "what happened to my theme" when they
    remove the footer template file without closing
    the tags that began in the header template
    file. Track down your tags and make sure they
    are closed. (A good way to verify that this is
    correct is to test your single and archive page
    views with an HTML validator).
CSS Styles in Templates




•   You are free to use whatever HTML and CSS
    tags and styles you like in your templates.
    However, you are encouraged to follow the
    standard WordPress theme structure (see
    Site Architecture 1.5). This will make your
    Themes more understandable to your users.
Wordpress on the Mac

•   Best platform - Coda - Panic Software - $100

        Version 2.0 just released
•   Blogging Adjunct
    •   Marsedit - Red-Sweater Software - $40

    Text Editors
    •   Textmate - Macromates - $40 V2 in
        gestation

        BBEdit - v10 - Barebones $50
Ad

More Related Content

What's hot (20)

W pthemes
W pthemesW pthemes
W pthemes
Becky Davis
 
Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.
Jacob Martella
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
Tammy Hart
 
BASICS OF HTML
BASICS OF HTMLBASICS OF HTML
BASICS OF HTML
Sasemohan C
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
Brendan Sera-Shriar
 
HTML Start Up - Introduction to HTML
HTML Start Up - Introduction to HTMLHTML Start Up - Introduction to HTML
HTML Start Up - Introduction to HTML
Grayzon Gonzales, LPT
 
Towards an Alternate WordPress Theme Structure
Towards an Alternate WordPress Theme StructureTowards an Alternate WordPress Theme Structure
Towards an Alternate WordPress Theme Structure
Graham Armfield
 
WordPress plugins
WordPress pluginsWordPress plugins
WordPress plugins
Christopher Ross
 
Using Custom Post Types and Advanced Custom Fields with Elementor
 Using Custom Post Types and Advanced Custom Fields with Elementor Using Custom Post Types and Advanced Custom Fields with Elementor
Using Custom Post Types and Advanced Custom Fields with Elementor
Angela Bowman
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014
Stephanie Eckles
 
Web1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSSWeb1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSS
NYCSS Meetup
 
WordPress Theme Design - Rich Media Institute Workshop
WordPress Theme Design - Rich Media Institute WorkshopWordPress Theme Design - Rich Media Institute Workshop
WordPress Theme Design - Rich Media Institute Workshop
Brendan Sera-Shriar
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
elliotjaystocks
 
Intro to HTML
Intro to HTMLIntro to HTML
Intro to HTML
UC Berkeley Graduate School of Journalism
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
Sitdhibong Laokok
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
Christopher Ross
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Chandra Prakash Thapa
 
Becoming a Respected WordPress Developer
Becoming a Respected WordPress DeveloperBecoming a Respected WordPress Developer
Becoming a Respected WordPress Developer
David Wolfpaw
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post Types
Nile Flores
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
WisdmLabs
 
Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.Keeping Your Themes and Plugins Organized.
Keeping Your Themes and Plugins Organized.
Jacob Martella
 
Custom WordPress theme development
Custom WordPress theme developmentCustom WordPress theme development
Custom WordPress theme development
Tammy Hart
 
WordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media InstituteWordPress 2.5 Overview - Rich Media Institute
WordPress 2.5 Overview - Rich Media Institute
Brendan Sera-Shriar
 
HTML Start Up - Introduction to HTML
HTML Start Up - Introduction to HTMLHTML Start Up - Introduction to HTML
HTML Start Up - Introduction to HTML
Grayzon Gonzales, LPT
 
Towards an Alternate WordPress Theme Structure
Towards an Alternate WordPress Theme StructureTowards an Alternate WordPress Theme Structure
Towards an Alternate WordPress Theme Structure
Graham Armfield
 
Using Custom Post Types and Advanced Custom Fields with Elementor
 Using Custom Post Types and Advanced Custom Fields with Elementor Using Custom Post Types and Advanced Custom Fields with Elementor
Using Custom Post Types and Advanced Custom Fields with Elementor
Angela Bowman
 
Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014Content-Driven WordPress Development - WordCamp Omaha 2014
Content-Driven WordPress Development - WordCamp Omaha 2014
Stephanie Eckles
 
Web1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSSWeb1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSS
NYCSS Meetup
 
WordPress Theme Design - Rich Media Institute Workshop
WordPress Theme Design - Rich Media Institute WorkshopWordPress Theme Design - Rich Media Institute Workshop
WordPress Theme Design - Rich Media Institute Workshop
Brendan Sera-Shriar
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
elliotjaystocks
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
Sitdhibong Laokok
 
Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)Building the basics (WordPress Ottawa 2014)
Building the basics (WordPress Ottawa 2014)
Christopher Ross
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
Chandra Prakash Thapa
 
Becoming a Respected WordPress Developer
Becoming a Respected WordPress DeveloperBecoming a Respected WordPress Developer
Becoming a Respected WordPress Developer
David Wolfpaw
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post Types
Nile Flores
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
WisdmLabs
 

Similar to Wordpress template hierarchy (20)

Intro to template hierarchy WCTO
Intro to template hierarchy  WCTOIntro to template hierarchy  WCTO
Intro to template hierarchy WCTO
Al Davis
 
WordPress Template hierarchy
WordPress Template hierarchyWordPress Template hierarchy
WordPress Template hierarchy
Jason Yingling
 
WordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - ThemesWordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - Themes
Metronet
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
Thad Allender
 
WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013
Curtiss Grymala
 
Overview on WordPress theme file structure and working functionality
Overview on WordPress theme file structure and working functionality Overview on WordPress theme file structure and working functionality
Overview on WordPress theme file structure and working functionality
Rakesh Kushwaha
 
WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013
Curtiss Grymala
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress theme
Dave Wallace
 
WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2
Mizanur Rahaman Mizan
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
LinnAlexandra
 
WordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 WorkshopWordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 Workshop
Curtiss Grymala
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme development
Naeem Junejo
 
Learning Wordpress - the internal guide
Learning Wordpress - the internal guideLearning Wordpress - the internal guide
Learning Wordpress - the internal guide
tom altman
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
Zero Point Development
 
Wordpress as a CMS
Wordpress as a CMSWordpress as a CMS
Wordpress as a CMS
Michael Hammel
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
Santosh Kunwar
 
Building a WordPress theme
Building a WordPress themeBuilding a WordPress theme
Building a WordPress theme
Josh Lee
 
Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Dissecting WordPress Themes and Page Templates, WordPress Columbus MeetupDissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Angela Meeker
 
Intro To WordPress Themes
Intro To WordPress ThemesIntro To WordPress Themes
Intro To WordPress Themes
damonsharp
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Curtiss Grymala
 
Intro to template hierarchy WCTO
Intro to template hierarchy  WCTOIntro to template hierarchy  WCTO
Intro to template hierarchy WCTO
Al Davis
 
WordPress Template hierarchy
WordPress Template hierarchyWordPress Template hierarchy
WordPress Template hierarchy
Jason Yingling
 
WordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - ThemesWordPress Bootcamp Part 3 - Themes
WordPress Bootcamp Part 3 - Themes
Metronet
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
Thad Allender
 
WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013
Curtiss Grymala
 
Overview on WordPress theme file structure and working functionality
Overview on WordPress theme file structure and working functionality Overview on WordPress theme file structure and working functionality
Overview on WordPress theme file structure and working functionality
Rakesh Kushwaha
 
WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013
Curtiss Grymala
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress theme
Dave Wallace
 
WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2WordPress Theme Design and Development Workshop - Day 2
WordPress Theme Design and Development Workshop - Day 2
Mizanur Rahaman Mizan
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
LinnAlexandra
 
WordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 WorkshopWordPress Themes 101 - PSUWeb13 Workshop
WordPress Themes 101 - PSUWeb13 Workshop
Curtiss Grymala
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme development
Naeem Junejo
 
Learning Wordpress - the internal guide
Learning Wordpress - the internal guideLearning Wordpress - the internal guide
Learning Wordpress - the internal guide
tom altman
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
Santosh Kunwar
 
Building a WordPress theme
Building a WordPress themeBuilding a WordPress theme
Building a WordPress theme
Josh Lee
 
Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Dissecting WordPress Themes and Page Templates, WordPress Columbus MeetupDissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Dissecting WordPress Themes and Page Templates, WordPress Columbus Meetup
Angela Meeker
 
Intro To WordPress Themes
Intro To WordPress ThemesIntro To WordPress Themes
Intro To WordPress Themes
damonsharp
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Curtiss Grymala
 
Ad

Recently uploaded (20)

Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
HusseinMalikMammadli
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
AI and Meaningful Work by Pablo Fernández Vallejo
AI and Meaningful Work by Pablo Fernández VallejoAI and Meaningful Work by Pablo Fernández Vallejo
AI and Meaningful Work by Pablo Fernández Vallejo
UXPA Boston
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptxUiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
anabulhac
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
DNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in NepalDNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in Nepal
ICT Frame Magazine Pvt. Ltd.
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdfComputer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
fizarcse
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
Best 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat PlatformsBest 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat Platforms
Soulmaite
 
Right to liberty and security of a person.pdf
Right to liberty and security of a person.pdfRight to liberty and security of a person.pdf
Right to liberty and security of a person.pdf
danielbraico197
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
UXPA Boston
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More MachinesRefactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Leon Anavi
 
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
Multi-Agent AI Systems: Architectures & Communication (MCP and A2A)
HusseinMalikMammadli
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
AI and Meaningful Work by Pablo Fernández Vallejo
AI and Meaningful Work by Pablo Fernández VallejoAI and Meaningful Work by Pablo Fernández Vallejo
AI and Meaningful Work by Pablo Fernández Vallejo
UXPA Boston
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptxUiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
UiPath AgentHack - Build the AI agents of tomorrow_Enablement 1.pptx
anabulhac
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
論文紹介:"InfLoRA: Interference-Free Low-Rank Adaptation for Continual Learning" ...
Toru Tamaki
 
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdfComputer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
fizarcse
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
Best 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat PlatformsBest 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat Platforms
Soulmaite
 
Right to liberty and security of a person.pdf
Right to liberty and security of a person.pdfRight to liberty and security of a person.pdf
Right to liberty and security of a person.pdf
danielbraico197
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
Longitudinal Benchmark: A Real-World UX Case Study in Onboarding by Linda Bor...
UXPA Boston
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Digital Technologies for Culture, Arts and Heritage: Insights from Interdisci...
Vasileios Komianos
 
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More MachinesRefactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Leon Anavi
 
Ad

Wordpress template hierarchy

  • 1. Wordpress Template Hierarchy Keith Lockhart
  • 2. Topics • Base Templates - Yoast Worpress Template Hierarchy • Tips and Tricks Wordpress on the Mac - if we have time...
  • 3. Wordpress Theme Anatomy blog works Cheat sheet for how your • Wordpress themes are made up of a folder of template files, each of which controls a specific piece of your theme. Every page has header, sidebar and footer files. • You can alter the files so that they show specific data depending on the page you are on.
  • 15. Template Files Within Template Files • You have seen how WordPress includes standard template files (header, footer, and sidebar) within the index.php template file. You can also include other template files within any of your template files. For example, sidebar.php might contain a template file that generates a search form — searchform.php. Because this is not one of WordPress's standard template files, the code to include it is a little different: • <?php get_search_form(); ?> We should no longer be using include and TEMPLATEPATH to get our search forms into themes as WordPress supplies the above template tag.
  • 16. Most WordPress Themes include a variety of template files within other templates to generate Template Files - index.php the web pages on the site. The following template files are typical for the main template (index.php) of a WordPress site: header.php • theloop.php (The Content) • wp-comments.php sidebar.php • searchform.php • footer.php However, this structure can be changed. For instance, you could put the search form in your header. Perhaps your design does not need a footer, so you could leave that template out entirely.
  • 17. Special Template Files • WordPress features two core page views of web pages in a WordPress site. The single post view is used when the web pages displays a single post. The multi-post view lists multiple posts or post summaries, and applies to category archives, date archives, author archives, and (usually) the "normal" view of your blog's home page. You can use the index.php template file to generate all of these types of pages or rely on WordPress' template hierarchy to choose different template files depending on the situation.
  • 18. What template file will Wordpress use? • What template file will WordPress use when a certain type of page is displayed? WordPress automatically recognizes template files with certain standard names and uses them for certain types of web pages. For example, when a user clicks on the title of a blog post, WordPress knows that they want to view just that article on its own web page. The WordPress template hierarchy will use the single.php template file rather than index.php to generate the page — if your Theme has a single.php file. Similarly, if the user clicks on a link for a particular category, WordPress will use the category.php template if it exists; if it doesn't, it looks for archive.php, and if that template is also missing, WordPress will go ahead and use the main index.php template. You can even make special template files for specific categories (see Category Templates for more information).
  • 19. one and ending in the other. • Template File Tips Eg. the html and body HTML elements typically begin in header.php and end in footer.php. Most WordPress themes make use of HTML div elements, which can also span several files. For instance, the main div for the page content might start in header.php and end in either index.php or single.php. • Tracking down where an HTML element begins and ends can get complicated if you are developing, designing, or modifying a Theme. Use comments to note in the template files where a large container tag opens and where it closes so you can track which div is which at the end of different sections. • WordPress automatically recognizes template files with certain standard names and uses them for certain types of web pages. For example, when a user clicks on the title of a blog post, WordPress knows that they want to view just that article on its own web page. The WordPress template hierarchy will use the single.php template file rather than index.php to generate the page — if your Theme has a single.php file. Similarly, if the user clicks on a link for a particular category, WordPress will use the category.php
  • 20. Tracking Opening and Closing Tags • Tracking down where an HTML element begins and ends can get complicated if you are developing, designing, or modifying a Theme. Use comments to note in the template files where a large container tag opens and where it closes so you can track which div is which at the end of different sections. • WordPress automatically recognizes template files with certain standard names and uses them for certain types of web pages. For example, when a user clicks on the title of a blog post, WordPress knows that they want to view just that article on its own web page.
  • 21. Tracking Opening and Closing Tags The WordPress template hierarchy will use the single.php template file rather than index.php to generate the page — if your Theme has a single.php file. • Similarly, if the user clicks on a link for a particular category, WordPress will use the category.php template if it exists; if it doesn't, it looks for archive.php, and if that template is also missing, WordPress will go ahead and use the main index.php template. • You can even make special template files for specific categories (see Category Templates for more information).
  • 22. Test Template Files Under Different Views If you have made changes to the comments, sidebar, search form, or any other template file, make sure you test them using different web page views (single post, different types of archives, and pages).
  • 23. Comment Deviations • If you are designing Themes for public release, keep in mind that someone who downloads your Theme will probably want to modify it slightly for their own use. So, it is helpful if you make notes in your template files where you have made changes from the logic of the Default and/or Classic Themes. It is also a good idea to add comments in your Theme's main style file if you have style information elsewhere (such as in your header.php file or in HTML tags).
  • 24. Close the Tag Door Behind You • If you start a HTML tag or div in one template file and don't close it there, make sure you include the closing tag in another template file. • The WordPress Forum gets a lot of questions about "what happened to my theme" when they remove the footer template file without closing the tags that began in the header template file. Track down your tags and make sure they are closed. (A good way to verify that this is correct is to test your single and archive page views with an HTML validator).
  • 25. CSS Styles in Templates • You are free to use whatever HTML and CSS tags and styles you like in your templates. However, you are encouraged to follow the standard WordPress theme structure (see Site Architecture 1.5). This will make your Themes more understandable to your users.
  • 26. Wordpress on the Mac • Best platform - Coda - Panic Software - $100 Version 2.0 just released • Blogging Adjunct • Marsedit - Red-Sweater Software - $40 Text Editors • Textmate - Macromates - $40 V2 in gestation BBEdit - v10 - Barebones $50
  翻译: