Using an image link menu in Drupal 6 instead of text
Sometimes, we don’t want to limit our creativity by just using text in all of the menu items. Sometimes, we would want to use an image as a link in a menu.
For example, you want to have Home as an image link rather than a text link. Here’s a code you can use in your theme’s template.php file.
function phptemplate_menu_item_link($link) {
if ($link['title']==’Home’) {
$link['localized_options']['html'] = TRUE;
$image_path = path_to_theme(). ‘images/home.png’;
$title = ‘Home’;
$link['title'] = theme(’image’, $image_path, $title, $title);
return theme_menu_item_link($link);
}
else {
return theme_menu_item_link($link);
}
}
Tags: Drupal 6 theming