The style.css file in a WordPress theme holds the theme's main styles and important information about the theme. This information helps WordPress recognize and display the theme details in the dashboard.
0
0
Style.css and theme metadata in Wordpress
Introduction
When creating a new WordPress theme from scratch.
When customizing or updating an existing theme's styles and metadata.
When sharing or distributing a theme so users can see theme details.
When troubleshooting theme recognition issues in WordPress.
When adding theme support or credits in the theme header.
Syntax
Wordpress
/* Theme Name: Your Theme Name Theme URI: http://example.com/your-theme Author: Your Name Author URI: http://example.com Description: A short description of your theme. Version: 1.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: your-theme-textdomain Tags: light, two-columns, responsive-layout */ /* Your CSS styles start here */
The metadata block must be at the very top of the
style.css file inside a CSS comment block.Each line starts with a key like
Theme Name followed by a colon and the value.Examples
A minimal metadata block for a simple blog theme.
Wordpress
/*
Theme Name: Simple Blog
Author: Jane Doe
Version: 1.0
Description: A clean and simple blog theme.
*/A full metadata example including URLs, license, and tags.
Wordpress
/*
Theme Name: Modern Portfolio
Theme URI: https://example.com/modern-portfolio
Author: John Smith
Author URI: https://example.com
Description: A modern portfolio theme with responsive design.
Version: 2.3
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: modern-portfolio
Tags: portfolio, responsive, grid-layout
*/Sample Program
This style.css file starts with the required theme metadata so WordPress can identify the theme. Below it, simple CSS styles set the font, background, and heading color.
Wordpress
/* Theme Name: Friendly Theme Theme URI: https://friendlytheme.example Author: Friendly Dev Author URI: https://friendlydev.example Description: A warm and welcoming WordPress theme. Version: 1.0 License: GNU General Public License v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Text Domain: friendly-theme Tags: friendly, clean, accessible */ body { font-family: Arial, sans-serif; background-color: #f9f9f9; color: #333333; } h1 { color: #2a7ae2; }
OutputSuccess
Important Notes
Always keep the metadata block at the top of style.css for WordPress to read it correctly.
Use meaningful and accurate information in the metadata to help users understand your theme.
The Text Domain is important for translations and should match your theme folder name.
Summary
The style.css file holds both the theme's styles and its metadata.
The metadata block tells WordPress the theme's name, author, version, and more.
Proper metadata helps WordPress list and manage your theme correctly.