What is a WordPress Theme Header?
A WordPress Theme Header is a structured CSS comment block placed at the very top of your theme’s main stylesheet (style.css). WordPress scans this file to discover the theme’s details (such as theme name, author, version, description, tags, and license) and lists it on the Appearance > Themes admin page.
Required vs. Optional Metadata in Theme Stylesheets
To register a custom theme template, certain comment tags are processed by the core framework:
- Theme Name: The only strictly required header. It registers the template inside the dashboard database records.
- Tags: Semicolon or comma-separated keywords describing layout attributes (e.g.
grid-layout,dark,two-columns). Used by the WordPress.org theme directory search filters. - Text Domain: Unique handle identifier used by translation functions (like
get_theme_file_uri()) to load localized localization files.
Child Theme Headers Conventions
When compiling style headers for a Child Theme, you must include a Template tag in the header. The Template tag value must match the exact directory name of the parent theme. This tells WordPress to fallback on the parent theme files for layout rendering:
/*
Theme Name: Sleek Portfolio Child
Template: sleek-portfolio
*/Frequently Asked Questions
Q: Where do I save this theme header block?
Save this block in a file named exactly style.css in your custom theme directory (e.g. wp-content/themes/my-theme/style.css) before activating the theme.
Q: Does this file need active CSS rules underneath?
Not necessarily. The file can contain only the comment header block if you prefer to queue your styles via functions.php using the wp_enqueue_style() hooks.