Which are the necessary files for a WordPress theme?

A classic theme must have two files:

  • style.css with a header comment (at least Theme Name).
  • index.php, the fallback template.

Usually a theme also has header.php, footer.php, functions.php, single.php, page.php and screenshot.png. A block theme needs style.css and templates/index.html.

/*
Theme Name: Mini Theme
*/
<?php echo 'Hello from a two file theme';
Terminal output

$ wp theme activate tc-mini
Success: Switched to 'Mini Theme' theme.
$ curl -s http://example.com/
Hello from a two file theme

See Theme Files and Functions.


Learn more about the similar topics:
Tutorials
WordPress Themes
WordPress Top Theme List
WordPress Theme Files and Functions
WordPress Template Hierarchy
WordPress Enqueue Scripts and Styles
WordPress Loop
WordPress WP_Query Class
Exercises & Assignments
Build and activate a minimal classic theme
Show the three latest posts with WP_Query
Load a stylesheet with wp_enqueue_style and a version
Show a message only on the front page
Create a child theme which changes the footer
Interview Questions & Answers
What is a WordPress theme?
What are commonly used WordPress theme functions?
Which function is used to get the home URL in WordPress?
Which are the necessary files for a WordPress theme?
What is the use of the wp_head() function in WordPress?
What is the WordPress Loop?
What is the difference between is_home() and is_front_page()?