1

I am new to drupal. I want to customize menu link

<ul class="nav nav-tabs sub-menu"><li class="menu-1308 first active"><a href="/" class="active">Top</a></li>
<li class="menu-1309"><a href="/all">All Posts</a></li>
<li class="menu-1310 last"><a href="/discussed">Discussed</a></li>
</ul>

to

<ul class="nav nav-tabs sub-menu"><li class="menu-1308 first active"><a href="/" class="active">Top</a></li>
<li class="menu-1309"><a href="/all">All Posts<span class="badge">42</span> </a></li>
<li class="menu-1310 last"><a href="/discussed">Discussed</a></li>
</ul>

Just add <span class="badge">42</span> next to "All Post" menu link.

1 Answer 1

0

This is the function you'll need: https://api.drupal.org/api/drupal/includes%21menu.inc/function/theme_menu_link/7

That allows you to overwrite the standard theme function. You could do an if statement to check for that specific menu link ID and do a custom output.

You'll need to put that in template.php within your custom theme and replace "theme_" in the function name with the name of your theme

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.