Milind More
Milind More

Reputation: 317

Adding span in navigation

I am Developing a website in Drupal 7

http://lorrells.seoperspective.com/

Now Problem here is the sidebar menu (on Left) my client wants something like in image below enter image description here

means he wants a small amount of text below the link so I was thinking to add "title" text below in span where I can style it

What I want is

<ul>
    <li class="menu-359 first"><a class="Litigation" title="Our niche Litigation Department punches well above its weight." href="http://lorrells.seoperspective.com/Litigation">Litigation</a><span>Our niche Litigation Department punches well above its weight.</span></li>
</ul>

code in page.tpl.php

 <div class="sidebar_menu"> 
     <?php

        $menu = menu_navigation_links('menu-sidebarmenu');
        print theme('links__menu-sidebarmenu', array('links' => $menu));


    ?>

    </div>

Upvotes: 1

Views: 197

Answers (2)

im_AI
im_AI

Reputation: 31

function ThemeName_link($variables) {
  return '<a href="' . check_plain(url($variables['path'], $variables['options'])) . '"' . drupal_attributes($variables['options']['attributes']) . '><span>' . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) . '</span></a>';
}

it's for all links in your theme.

Upvotes: 3

D34dman
D34dman

Reputation: 1271

Method 1: Have you had a look at this contrib module? It will expose you a checkbox to enter html in menu titles. But am warning you, html in menu items are risky business. Make sure the permissions are set correctly.

Method 2: Another way you could achieve the same effect could be creating a block with custom markup. But then if you give permission to edit that to your client, that would probably be a disaster waiting to happen.

Method 3: If you are comfortable in playing with hooks, hook_menu_link_alter(&$item) could be used to set html attribute to true, and also reformat the title, the way you want it.

Upvotes: 1

Related Questions