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 Basic Structure
- index.php
- header.php
- footer.php
- sidebar.php
Index.php File
<?php
get_header();
get_sidebar();
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
the_content();
endwhile;
endif;
get_footer();
?>
Folder Structure
Files Required to Make a Theme
- index.php
- style.css
Most Themes Also Include
- header.php
- footer.php
- sidebar.php
- functions.php
- screenshot.png
You Should Also Include
- single.php
- page.php
- archive.php
- category.php
- tag.png
- comments.png
It's Good To Also Include
- 404.php
- search.php
- front-page.php
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.
- How is it similar to what's been covered?
- How is it different than what's been covered?
- How would you structure the folder and files if you were to build a theme?
Question 1
Which files make up the structure of a basic WordPress page?
- header.php, sidebar.php, index.php, footer.php
- header.php, sidebar.php, function.php,footer.php
- homepage.php, header.php, index.php, footer.php
Question 2
Which files are required for a WordPress theme?
- blog.php, page.php, and style.css<.li>
- index.php and style.css
- header.php and footer.php