Hi I am web designer and I would like to know how to set menu subtitle? It is easily possible with yoo themes but I need to know how it is done without using YooTheme templates. I think there is need of little modification in mod_menu but I don't know what exactly. I googled all day and can't find a solution.
1条回答 默认 最新
- douyimin1083 2012-11-19 10:12关注
There are certainly better solutions but i've done it this way:
Insert a charakter in the name of your menu-item. For example a "|". It should look like this: Title | Subtitle. At this position you can divide the name.
Now you have to override the file default_component.php in modules/mod_menu/tmpl.
Add this lines:
$parts = explode("|", $linktype); // the "|" is the divider if(isset($parts[1])){ $linktype = $parts[0].'<span>'.$parts[1].'</span>'; }else{ $linktype = $parts[0]; };
after:
$class = $item->anchor_css ? 'class="'.$item->anchor_css.'" ' : ''; $title = $item->anchor_title ? 'title="'.$item->anchor_title.'" ' : ''; if ($item->menu_image) { $item->params->get('menu_text', 1 ) ? $linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" /><span class="image-title">'.$item->title.'</span> ' : $linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" />'; } else { $linktype = $item->title; }
Now you have a span around the subtitle and it's possible to style it.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报