In WordPress themes, the style.css file contains important information. What is its main purpose?
Think about what controls the look and basic info of a theme.
The style.css file in a WordPress theme is special because it not only holds the CSS styles but also the theme metadata in comments at the top. This metadata tells WordPress about the theme's name, author, version, and more.
Which of the following style.css headers correctly defines the theme name and author?
WordPress expects the metadata in a CSS comment block.
The theme metadata must be inside a CSS comment block starting with /* and ending with */. Options A, B, and D use comment styles not valid in CSS.
If a WordPress theme's style.css file lacks the required metadata header, what will WordPress do when you try to activate the theme?
Think about how WordPress recognizes themes.
WordPress uses the metadata in style.css to identify and list themes. Without it, the theme won't appear in the theme list and cannot be activated through the dashboard.
Look at this style.css header snippet:
/* Theme-Name: Awesome Theme Author: John Smith */
Why does WordPress fail to recognize this theme?
Check the exact spelling of metadata keys.
WordPress expects the metadata keys to be exact. Theme Name must be spelled with a space, not a dash. Using Theme-Name causes WordPress to ignore the metadata.
Given this style.css metadata block:
/* Theme Name: Simple Theme Theme URI: https://example.com/simple-theme Author: Alice Author URI: https://example.com Description: A simple WordPress theme. Version: 1.0 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Text Domain: simple-theme Tags: light, two-columns, responsive-layout */
Which of the following is true about how WordPress displays this theme in the dashboard?
WordPress uses all standard metadata keys to display theme info.
WordPress reads all standard metadata keys like Theme Name, Author, Version, Description, and Tags from the style.css header and shows them in the theme dashboard.