Guides · 7 min read

WordPress theme file structure, explained

If you are converting a static site to WordPress — by hand or with a tool — these are the files you will end up with, what each one does, and the minimum WordPress actually requires.

The two files WordPress requires

A valid theme needs exactly two files: style.css and index.php. Everything else is refinement. style.css must open with a header comment declaring the theme name — WordPress reads it to list the theme in wp-admin:

style.css header
/*
Theme Name: My Theme
Author: You
Description: Converted from static HTML.
Version: 1.0
*/

Template parts: header.php and footer.php

Anything repeated at the top and bottom of every page — doctype, <head>, site header, footer — moves into header.php and footer.php. Templates include them with get_header() and get_footer(). This is the single biggest structural difference from static HTML: repetition is factored out instead of copied.

The template hierarchy

WordPress picks a template per request: single.php for posts, page.php for pages, archive.php for listings, falling back to index.php when a specific template is missing. A converted brochure site typically ships index.php plus page.php; blog templates can be added later without touching the rest of the theme.

functions.php: supports, menus, enqueues

functions.php is the theme’s boot file. Three jobs matter for conversions: registering theme supports (title-tag, post-thumbnails), registering menu locations for wp_nav_menu(), and enqueueing your stylesheets and scripts so asset URLs resolve inside wp-content:

functions.php (excerpt)
wp_enqueue_style(
  'mytheme-main',
  get_template_directory_uri() . '/assets/css/style.css',
  [],
  '1.0'
);

The loop, briefly

Where a static page hard-codes its content, a template runs the loop: while (have_posts()) : the_post(); … the_content(); … That is what makes text editable in wp-admin. Code2CMS maps your main content region to the loop and shows you the result in the preview — you can verify the mapping before paying for the ZIP.

Put it into practice — paste your HTML, see the real output.

See a generated theme free