I noticed that the node-type class is used in the body class and then it is used again further down inside the #content-area id div.
This kind of bugged me as I would like these classes to be more unique. How would I go about changing the first node-type- class into page-class-?

Becky

Comments

beckyjohnson’s picture

This is what I have so far: $vars['body_classes'] = str_replace('node-type-', 'page-type-', $vars['body_classes']);}

Becky

echoz’s picture

You are correct except you have the closing bracket without the opening one of the preprocess_page function -

function STARTERKIT_preprocess_page(&$vars, $hook) {
  $vars['body_classes'] = str_replace('node-type-', 'page-type-', $vars['body_classes']);
}

Incidentally, I brought this up a while ago (http://drupal.org/node/320365) and JohnAlbin informed us that it is core that provides that body class, and zen provides the class on the node div.

beckyjohnson’s picture

Oh that's really interesting echoz. Thanks for correcting my code. That makes more sense...

Becky

dadderley’s picture

Thanks,
I use the themer module which writes in token based body classes as well as clases base on the path.
I wound up with a duplicate of the "front" body class which is not that good.

I used your code like this:

function mythemename_preprocess_page(&$vars, $hook) {
  $vars['body_classes'] = str_replace('front', 'frontpage', $vars['body_classes']);
}

The class "front" becomes class "frontpage" .

akalata’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.