Anatomy of a Theme

Lesson Repository

Anatomy of a Theme

Learn about the different files that make up a theme
and how they work together to display your WordPress website

WordPress logo blueprint style
Created by Michelle Schulp

WordPress Basic Structure

  1. index.php
  2. header.php
  3. footer.php
  4. sidebar.php
WordPress basic structure
WordPress basic structure

Index.php File

			<?php
			   get_header();
			   get_sidebar();
			      if ( have_posts() ) :
			         while ( have_posts() ) :
			            the_post();
			               the_content();
			         endwhile;
			      endif;
			   get_footer();
			?>
		

Folder Structure

WordPress basic structure

Files Required to Make a Theme

  1. index.php
  2. style.css

Most Themes Also Include

  1. header.php
  2. footer.php
  3. sidebar.php
  4. functions.php
  5. screenshot.png

You Should Also Include

  1. single.php
  2. page.php
  3. archive.php
  4. category.php
  5. tag.png
  6. comments.png

It's Good To Also Include

  1. 404.php
  2. search.php
  3. front-page.php

Exercises

Pseudo-Code A Page

Outline the files needed to implement the basic structure of a WordPress page that would include a sidebar on the right.

Examine a Themes Folder and Files

Download any theme and examine the folder and files that are used.

  1. How is it similar to what's been covered?
  2. How is it different than what's been covered?
  3. How would you structure the folder and files if you were to build a theme?

Quiz

Question 1

Which files make up the structure of a basic WordPress page?

  1. header.php, sidebar.php, index.php, footer.php
  2. header.php, sidebar.php, function.php,footer.php
  3. homepage.php, header.php, index.php, footer.php

Question 2

Which files are required for a WordPress theme?

  1. blog.php, page.php, and style.css<.li>
  2. index.php and style.css
  3. header.php and footer.php