3

Which theme details are absolutely required for your style.css file header?

I'm developing my first theme for personal use, so do I really have to include things like a license, license uri, author, author uri, etc.

WordPress Docs just give an example, but they don't reference what's required. Does anyone know?

/*
Theme Name: Twenty Thirteen
Theme URI: http://wordpress.org/themes/twentythirteen
Author: the WordPress team
Author URI: http://wordpress.org/
Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, flexible-width, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready
Text Domain: twentythirteen

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
1
  • 1
    Just to add to @s_ha_dum answer below, Text Domain: twentythirteen is also very important to include if you are going to translate your theme using po and mo templates. If not, you can scrap that May 12, 2014 at 4:31

2 Answers 2

2

A quick test indicates that you don't actually need anything in that header for standalone theme. A theme with a completely blank header registers and loads just fine, both front and back end.

If it is a child theme you need the Template: line.

However...

In addition to CSS style information for your theme, style.css provides details about the Theme in the form of comments. The stylesheet must provide details about the Theme in the form of comments. No two Themes are allowed to have the same details listed in their comment headers, as this will lead to problems in the Theme selection dialog. If you make your own Theme by copying an existing one, make sure you change this information first.

http://codex.wordpress.org/Theme_Development#Stylesheet_Guidelines

... leaving everything blank could potentially cause trouble if, for example, you try the same trick twice. Just give the theme minimal detail and you should be fine for a personal theme that you are not releasing. Say...

/*
Theme Name: Twenty Thirteen
Author: the WordPress team
Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small.
Version: 1.0
*/
3
  • 1
    I would like to add that if you base your theme off TwentyThirteen (or any default theme), it's better to make a child theme. The reason for that is that if the former comes with an update, you can update along with it. If you start off with a standalone theme and there comes a security update (as an example), then you're stuck with basically insecure code...
    – user2015
    May 12, 2014 at 6:23
  • Thanks. I knew how child themes worked, but I wasn't sure about the actual theme. Also good comment Piet, I learned about child themes the hard way, making hard edits to a theme and then they released an update, and I had to find all of my edits and replace them on the update. That was a pain.
    – Derek
    May 12, 2014 at 17:01
  • @Derek : I figure out most of this stuff by hacking things on a local development server-- I highly recommend it :)
    – s_ha_dum
    May 12, 2014 at 17:08
0

There is a difference between what is required and what is a best practice. If you load the Developer plugin, one of the plugins it will load is called "Theme Checker." The Theme Checker is for themes that you want to submit to the Wordpress directory, but it is also good to check your private, custom themes.

If you run that, you'll see all of the things you are missing that Wordpress is looking for in a good theme. It is good to get into the practice of putting all of that in. If your client gets a new web designer or if you ever want to share the theme it will be good to have more meta info in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.