Search⌘ K

Creating a Custom Theme

Explore how to build a custom WordPress theme by creating and organizing key files like style.css and index.php. Understand theme metadata setup, file structure, and how to activate your theme in the WordPress dashboard.

Theme files

A web page is composed of different chunks where we have a header, navigation links, main content, sidebar, comments sections and footer. A theme contains multiple files that control the styling and content of these sections. While there may be a large number of files in a theme, two files are compulsory.

  • style.css: This is the master stylesheet of the theme.

  • index.php: This is the fallback file to display all web pages of the website.

A theme can have other files, which are listed below:

  • functions.php: A pure PHP file which directs the WordPress system to initiate certain features and override the defaults.

  • single.php: Displays the individual posts.

  • page.php: Powers the static pages of the website.

  • header.php: Displays a global header on all web pages of the website.

  • footer.php: Displays the footer and loads JavaScript files.

  • front-page.php: Powers the main landing page of the website.

  • archive.php: Displays posts in a hierarchical format.

  • search.php: Displays the search results ...