How do I theme the secondary menu? The following code allows me to print the secondary menu.

&lt;?php print theme('links__system_secondary_menu', array('links' =&gt; $secondary_menu, 'attributes' =&gt; array('id' =&gt; 'secondary-menu', 'class' =&gt; 'menu nav navbar-nav secondary hidden-xs'))); ?&gt;     


I get the following output.

&lt;ul id="secondary-menu" class="menu nav navbar-nav secondary hidden-xs"&gt;
&lt;li class="menu-6734 first"&gt;&lt;a href="/" title=""&gt;link 1&lt;/a&gt;&lt;/li&gt;
&lt;li class="menu-6735 first"&gt;&lt;a href="/" title=""&gt;link 2&lt;/a&gt;&lt;/li&gt;
&lt;li class="menu-6736 first"&gt;&lt;a href="/" title=""&gt;link 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


Now, I need to add dropdown to the last menu item but I have no idea how to do it. Any guidance much appreciated!
You can theme secondary menu using THEME_links__system_secondary_menu like the following:

function THEME_links__system_secondary_menu(&amp;$vars) {
  // Get links:
  $links = $vars['links'];
  // Get the index of last menu item.
  end($links);
  $last_ele_index = key($links);
  // Here do your logic by change ...
  // $vars['links']['$last_ele_index'];
}