Note that there are some explanatory texts on larger screens.

plurals
  1. PODrupal - Add custom html in li to menu ul?
    primarykey
    data
    text
    <p>Is there any way to write some html (as you might in a block), and have that html appear as a menu item?</p> <p>My situation is that I want some text that is not a link to say 'Follow us on:', and then I want 2 images which are both links to twitter and facebook.</p> <p>Menu html cant do this as it requires any html you write to be part of a link, and to be the same link for that menu entry. <a href="http://drupal.org/project/menu_html" rel="nofollow">http://drupal.org/project/menu_html</a></p> <p>I really want the html I add to be within the menu list. Thanks</p> <p>UPDATE Code doesn't work well in the comments so im adding it here. This link seemed to be the closest to what you were suggesting:</p> <p><a href="http://api.drupal.org/api/drupal/includes--menu.inc/function/theme_menu_item/6" rel="nofollow">http://api.drupal.org/api/drupal/includes--menu.inc/function/theme_menu_item/6</a></p> <p>So I added this to my template.php:</p> <pre><code>function localhost_petitpim_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); if (!empty($extra_class)) { $class .= ' ' . $extra_class; } if ($in_active_trail) { $class .= 'active-trail myactive'; } return '&lt;li class="' . $class . '"&gt;' . $link . $menu . "&lt;/li&gt;\n"; } </code></pre> <p>All ive done is add a class of 'myactive' so I can see if its working. My theme name is 'localhost_petitpim'. Ive refreshed the cache. My theme is set to 'Rebuild theme registry on every page.' I cant see the new class being applied. Have I done something wrong? Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload