How to override theme() part in page.tpl.php file? This question is extension of this question: Current Username title instead Secondary menu title, but it is different.

I would like to how can I override the following part of code  theme('links__system_secondary_menu',............) which is in page.tpl.php

For example, if I want to change text =&gt; t('Secondary menu') to text =&gt; t('Any new text'). 


One way to do this, which I think is just change that part in page.tpl.php and it works perfectly.

OR

Is there any other way like hook-way to do this, so we can write function in template.php and that override only that part?  

from page.tpl.php

&lt;?php if ($secondary_menu): ?&gt;
      &lt;div id="secondary-menu" class="navigation"&gt;
        &lt;?php print theme('links__system_secondary_menu', array(
          'links' =&gt; $secondary_menu,
          'attributes' =&gt; array(
            'id' =&gt; 'secondary-menu-links',
            'class' =&gt; array('links', 'inline', 'clearfix'),
          ),
          'heading' =&gt; array(
            'text' =&gt; t('Secondary menu'),
            'level' =&gt; 'h2',
            'class' =&gt; array('element-invisible'),
          ),
        )); ?&gt;
      &lt;/div&gt; &lt;!-- /#secondary-menu --&gt;
    &lt;?php endif; ?&gt;


Thanks,
You can override theme_links__system_secondary_menu() in template.php. You will name it MODULENAME_links__system_secondary_menu(), and the original code can be seen here: https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_links/7.x

Copy that code, and modify it as necessary.