title: Drupal 7: Modifying menu HTML output?
body: <p>I am trying to modify the HTML output in a Drupal 7 theme that I am creating.</p>
  
  <p>Basically, instead of the &lt; li >s containing just plain &lt; a >s with text, I want to include some additional HTML inside the &lt; a >.</p>
  
  <p>I know that it's possible to modify the HTML created by the menus in Drupal. I can see the following call in page.tpl.php:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php print theme('links__system_main_menu', array(
        'links' =&gt; $main_menu,
        'attributes' =&gt; array(
          'id' =&gt; 'main-menu',
          'class' =&gt; array('links', 'clearfix'),
        ),
        'heading' =&gt; array(
          'text' =&gt; t(''),
          'level' =&gt; 'h2',
          'class' =&gt; array('element-invisible'),
        ),
      )); ?&gt;
  </code></pre>
  
  <p>which apparently calls the theme function, which creates the output. One way to modify the output would be to modify the theme_links function in theme.inc, right? </p>
  
  <p><a href="http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_links" rel="noreferrer">http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_links</a></p>
  
  <p>I also know that you can put a hook in template.php to override the function which creates the HTML. I can't figure out how to create the actual override function. Can somebody point me in the right direction, please? </p>