Answer the question
In order to leave comments, you need to log in
How to add a class to a child ul?
Good afternoon. I'm interested in the actual question:
I created a mega menu, but one class for ul had to be defined in jquery, but I'm not very happy with it, because while the page is loading, it looks disgusting.
I found this feature
function имя_menu_tree__main_menu($variables) {
return '<ul class="каокй-то класс">' . $variables['tree'] . '</ul>';
}
Answer the question
In order to leave comments, you need to log in
You need to add something like this code to the template.php file of the theme
function ИМЯТЕМЫ_menu_link__ИМЯМЕНЮ($variables) {
$element = $variables['element'];
$sub_menu = '';
// Задаем условие по пункту меню
if ($element['#original_link']['mlid'] == 482) {
// Указываем функцию темизации
$element['#below']['#theme_wrappers'] = array('menu_tree__one_link');
}
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";
}
function ИМЯТЕМЫ_menu_tree__one_link($variables) {
return '<ul class="myclass">' . $variables['tree'] . '</ul>';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question