Is the syntax for the Wordpress style.css template element available anywhere?

The syntax is for the Wordpress style.css template element

I've recently embarked upon the grand voyage of Wordpress theming and I've been reading through the Wordpress documentation for how to write a theme. One thing I came across here was that the style.css file must contain a specific header in order to be used by the Wordpress engine. They give a brief example but I haven't been able to turn up any formal description of what must be in the style.css header portion. Does this exist on the Wordpress site? If it doesn't could we perhaps describe it here?

I think all of the answers so far are valid (obviously, I linked to the docs myself). What I'm looking for is a more formal description, i.e. Case Insensitive, What's the Template element, How free can your version number be (Oracle style x.x.x.x.x?). Thanks though, so far!

aha, that makes a little more sense. It's pretty much free-text as far as I know, no requirements at all. In fact, at least in 2.7 (bleeding-edge trunk) even if that block is missing the style is still available. I'll document more when I have a few minutes.

2 Answers

Based on codex wordpress Theme_Development:

The following is an example of the first few lines of the stylesheet, called the style sheet header, for the Theme "Rose":

/*
Theme Name: Rose
Theme URI: the-theme's-homepage
Description: a-brief-description
Author: your-name
Author URI: your-URI
Template: use-this-to-define-a-parent-theme--optional
Version: a-number--optional
Tags: a-comma-delimited-list--optional

General comments/License Statement if any.

*/

The simplest Theme includes only a style.css file, plus images if any. To create such a Theme, you must specify a set of templates to inherit for use with the Theme by editing the Template: line in the style.css header comments. For example, if you wanted the Theme "Rose" to inherit the templates from another Theme called "test", you would include Template: test in the comments at the beginning of Rose's style.css. Now "test" is the parent Theme for "Rose", which still consists only of a style.css file and the concomitant images, all located in the directory wp-content/themes/Rose. (Note that specifying a parent Theme will inherit all of the template files from that Theme — meaning that any template files in the child Theme's directory will be ignored.)

The comment header lines in style.css are required for WordPress to be able to identify a Theme and display it in the Administration Panel under Design > Themes as an available Theme option along with any other installed Themes.

The Theme Name, Version, Author, and Author URI fields are parsed by WordPress and used to display that data in the Current Theme area on the top line of the current theme information, where the Author's Name is hyperlinked to the Author URI. The Description and Tag fields are parsed and displayed in the body of the theme's information, and if the theme has a parent theme, that information is placed in the information body as well. In the Available Themes section, only the Theme Name, Description, and Tags fields are used.

None of these fields have any restrictions - all are parsed as strings. In addition, none of them are required in the code, though in practice the fields not marked as optional in the list above are all used to provide contextual information to the WordPress administrator and should be included for all themes.

You are probably thinking about this:

/*
THEME NAME: Parallax
THEME URI: http _ parallaxdenigrate _ net
VERSION: .1
AUTHOR: Martin Jacobsen
AUTHOR URI: http _ martinjacobsen _ no
*/

If I'm not way off, Wordpress uses this info to display in the "Activate Design" dialog in the admin backend.

How do you add a JavaScript widget to a Wordpress hosted blog?

How do you add a JavaScript widget to a Wordpress hosted blog?

I've got a site that provides blog-friendly widgets via JavaScript. These work fine in most circumstances, including self-hosted Wordpress blogs. With blogs hosted at Wordpress, however, JavaScript isn't allowed in sidebar text modules. Has anyone seen a workaround for this limitation? 4 Answers you could always petition wp to add your widget to their 'approved' list, but who knows how long that would take. you're talking about a way to circumvent the rules they have in place about posting arbitrary script. myspace javascript exploits in particular have increased awareness of the possibility of such workarounds, so you might have a tough time getting around the restrictions - however, here's a classic ones to try: put the javascript in a weird place, like anywhere that executes a URL. for instance: <div style="background:url('javascript:alert(this);');" /> sometime…

Read more…

Using Apache mod_rewrite to remove sub-directories from URL

Using Apache mod_rewrite to remove sub-directories from URL

I'm managing an instance of Wordpress where the URLs are in the following format: /example-category/blog-post-permalink/ The blog author did an inconsistent job of adding categories to posts, so while some of them had legitimate categories in their URLS, at least half are "uncategorised". I can easily change Wordpress to render the URL without the category name (e.g., /blog-post-permalink/), but I'd like to create a mod_rewrite rule to automatically redirect any requests for the previous format to the new, cleaner one. How can I use a mod_rewrite recipe to handle this, taking into account that I want to honor requests for the real…

Read more…

Joomla Blog/Wordpress Integration

Joomla Blog Wordpress Integration

I'm looking for a wordpress-like blog interface to put inside a Joomla hosted site. The admin interface of Joomla is quirky enough and hard enough to use that daily updates are infeasible. What I am looking for is an easy-to-use posting interface that supports multiple users with different accounts/names, a tagging scheme, and easy find by date/user/tag functionality. In particular I'm looking for a relatively easy-to-deploy, out-of-the-box solution, and would prefer not to…

Read more…