Add to your template.tpl.php the following function:
function YourThemeName_preprocess_html(&$variables) {
if (empty($variables['page']['RegionName'])) {
$variables['classes_array'][] = 'YourClassName';
}
}
Drupa API
7 – 8 template_preprocess_html(&$variables)
http://api.drupal.org/api/drupal/includes--theme.inc/function/template_preprocess_html/7
Electrical & Computer Engineer MSc with great love in Drupal (http://drupal.org/user/829430).
PosterGenius™ team member & More Than (just) Themes web developer.
Wednesday, June 29, 2011
Sunday, June 5, 2011
Add unique class (mlid) to all Drupal 7 menu items
Main and secondary menus has a great class .menu-123 (.menu-mlid) to do that. So here how you can port the same behavior to any/all menu items. Add the following function in your template.php file,
Thanks betarobot for this comment
<?php
/**
* Add unique class (mlid) to all menu items.
*/
function YOURTHEMENAME_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
$element['#attributes']['class'][] = 'menu-' . $element['#original_link']['mlid'];
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
?>
7 – 8 theme_menu_link(array $variables)
See core function theme_menu_link for Drupal 7 - 8 at http://api.drupal.org/api/drupal/includes--menu.inc/function/theme_menu_link/7Thanks betarobot for this comment
Ετικέτες
Drupal,
Drupal 7,
Drupal Themes
Subscribe to:
Posts (Atom)