WordPress theme fundamentals: understand what all of these files do!

Lesson#2 of 13 in project Theory


What all that files do?

  1. style.css: The main stylesheet. Contains theme information in a comment block at the top.
  2. index.php: The main template file. Required for every theme.
  3. functions.php: Theme functions file. Used to add features and functionality.
  4. header.php: Contains the site’s header section (logo, navigation, etc.).
  5. footer.php: Contains the site’s footer section.
  6. sidebar.php: Contains the sidebar content.
  7. page.php: Template for static pages.
  8. single.php: Template for single blog posts.
  9. archive.php: Template for archive pages (categories, tags, dates).
  10. comments.php: Handles the comments section.
  11. screenshot.png: Image preview of the theme (shown in the WP admin).

Themes may also include:

  1. 404.php: Custom 404 error page.
  2. search.php: Search results template.
  3. template-parts/: Folder for reusable template parts.
  4. assets/: For CSS, JS, images, etc.