I am using Drupal 7 with the Bootstrap theme and a customised subtheme.
I would like to modify template.php
to add a class for each <li>
in the menu. As per instructions provided in:
https://drupal.org/comment/5830446#comment-5830446
Instructions say:
"...use this snippet in
template.php
to put a unique id for<a>
and<li>
elements at the same time"
<?php
/**
* theme_menu_link()
*/
function MYSUBTHEME_menu_link(array $variables) {
//add class for li
$variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid'];
//add class for a
$variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid'];
//dvm($variables['element']);
return theme_menu_link($variables);
}
?>
Which template.php
file should I modify? and how? I have the following template.php
available:
./bootstrapMYSUBTHEME/template.php ./bootstrapMYSUBTHEME/templates/template.php ./bootstrap/template.php ./bootstrap/bootstrap_subtheme/template.php
/bootstrap/bootstrap_subtheme/
an example dir only, to copy-paste to start writing your own subtheme? And where/bootstrapMYSUBTHEME/templates/template.php
came from? I'm working on a site that uses Bootstrap + it's subtheme (not as an theme guy, but anyway) and we certainly don't have it.