Hiya,

I'm trying to style a custom menu within drupal 6

I've sucessfully styled to display a background image, but the problem is that the menu item title text still displays. So I get a nice image, with the text blazoned all over it.

Is there a template function I could use to format the custom menu and remove the text portion from the hyperlink?

I've done something similar on my primary links (see below) but I could do with some help figuring out how to do so on the custom menus.

function primary_links_add_icons() {
  $links = menu_primary_links();
  $level_tmp = explode('-', key($links));
  $level = $level_tmp[0];
  $output = "<ul class=\"links-$level\">\n";   
  if ($links) {
    foreach ($links as $link) {
        $link = l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']);
        $cssid = str_replace(' ', '_', strip_tags($link));
        $link = preg_replace('#(<a.*?>).*?(</a>)#', '$1$2', $link);
        $output .= '<li id="'.$cssid.'">' . $link .'</li>';
    };
    $output .= '</ul>';
  }
  return $output;
}

And then this called within the page.tpl.php

print primary_links_add_icons();

Thanks for any help!

Comments

hfidge’s picture

OK someone has pointed me at

http://api.drupal.org/api/function/theme_menu_tree

But thats not a great help - i'm still unclear on how to add or remove bits of code within this function.

hfidge’s picture

Answer was easy all along:

text-indent:-9999px;