Important WordPress Files Banner

2 Important Files in WordPress Theme

These two files are the key to your theme, in other words you cannot have a verified theme without these two files. These files communicate with WordPress core files and show as proper theme in dashboard. From where you can choose to activate the theme. This is the beginning of your custom theme.

Those files are:

  1. style.css
  2. index.php


CSS file is responsible for the visual design of any site. It controls the presentation part of any webpage as well as if it is in WordPress and file name is style.css it has more purpose than to just style the site’s visual design and layout. You can create a child theme just with style.css and some comments on it. If you check default theme’s (twentysixteen in this case) style.css, on top you can see following lines of text.

The first line “Theme Name: Twenty Sixteen” denotes the Exact name of the theme. Titles are self-explanatory. You can easily understand what it is by just looking at it. You can just copy it for your theme and modify it as per your need. Single most important part is “Theme Name” part. If you don’t miss it your theme is ok.


Index.php is the main template file it is fallback template for all the templates. WordPress has a list of theme files which are recognized by WordPress themes and each of the theme files in other words template file have unique purpose in site. But if there is no template files it uses index.php. We have to use WordPress loops to print dynamic content.

This piece of code will return the content of the page or post you have created in dashboard. This is called The Loop, using this loop WordPress processes each posts or page to be displayed on the current page, and formats it according to how it matches specified criteria within the Loop Tags.


Some specific tags need to be inside the loop to work or render the data it should render. Like the template tag to generate post title ie. the_title(); or to generate post’s published time ie. the_time(); or in case of post category the_category(); You can check the loop in action.


Above mentioned files are important because it helps a theme to be recognized by dashboard but there are a list of pages required to complete a theme. Like header.php, footer.php, functions.php, page.php, single.php, comments.php, search.php etc. Check the list of basic template files here and for fallback template and custom templates to use please check template hierarchy

WordPress Template Hierarchy