Sunday, 1 January, 2012

Use our new body_class template tag to create even better themes

Body classes are something you have told us you want more control over when designing themes. Starting today the body class is available on your Skrivr site.

Instead of the old <body> the body-tag now looks like this:

<body class="category how-to"> or <body class="main"> and so on.

To get the body classes you just add {{ body_class }} to the body tag in your templates:

<body class="{{ body_class }}">

Different pages, different classes.

These are the default classes that Skrivr adds:

The main page of your site gets the 'main' class.

<body class="main">

A category page gets two classes; first the generic 'category' class but also the class of the current category being shown.

<body class="category latest">

The individual post also gets two classes; first 'post' and then the name of the category the post belongs to. We decided to add this so that you can create a category specific design for your posts.

<body class="post latest">

Finally the static pages ('About', 'Contact' etc) gets the 'static' class.

<body class="static">

In addition to these new classes we are also working on individual IDs for posts. More on this later!