Overriding theme_links__main_menu() I have the following call in page.tpl.php.

 theme('links__main_menu',array(...));


How can I override the theme function that is being called from that code?
In a theme, you just declare the mytheme_links__main_menu() function in the template.php file. (Replace mytheme with the actual name of the theme.)

In a module, you declare the mymodule_links__main_menu() function, and implement hook_theme() to define the theme function. (Replace mymodule with the actual name of the module.)

The argument passed to the function are the same passed to theme_links().

$variables: An associative array containing:


links: An associative array of links to be themed. The key for each link is used as its CSS class. Each link should be itself an array, with the following elements:


title: The link text.
href: The link URL. If omitted, the 'title' is shown as a plain text item in the links list.
html: (optional) Whether or not 'title' is HTML. If set, the title will not be passed through check_plain().
attributes: (optional) Attributes for the anchor, or for the  tag used in its place if no 'href' is supplied. If element 'class' is included, it must be an array of one or more class names.


If the 'href' element is supplied, the entire link array is passed to l() as its $options parameter.


attributes: A keyed array of attributes for the UL containing the list of links.
heading: (optional) A heading to precede the links. May be an associative array or a string. If it's an array, it can have the following elements:


text: The heading text.
level: The heading level (e.g. 'h2', 'h3').
class: (optional) An array of the CSS classes for the heading.