I have tried to change the text in the 'Read more' link by putting:

function myzen_more_link($url, $title) {
  watchdog("template.php","myzen_more_link");
  return '<div class="more-link">' . 
    t('<a href="@link" title="@title">( more ... )</a>', 
    array('@link' => check_url($url), 
    '@title' => $title)) . '</div>';
}

In the template.php in my zen subtheme folder but it does not appear to work.

Almost all of the discussions I have seen about formatting the "more_link" concentrate on its placement. Can anyone tell me why this theme override does not take effect?

Thanks,

link|improve this question
When possible, avoid adding HTML tags in a string passed to t(). In your case, the <a> tag is at the beginning of the string, and it doesn't contain anything that needs to be translated. – kiamlaluno Mar 31 '11 at 0:29
This is actually copied directly from the theme.inc function theme_more_link. (line 1600) – drumped Mar 31 '11 at 0:49
feedback

2 Answers

What you have done should work. Have you remembered to clear cache?

link|improve this answer
Yes. It would useful to know how to trace this. The function is never called. The only way I could change the value was to modify the theme.inc file. – drumped Mar 30 '11 at 21:30
It should work, as described in Beginners guide to overriding themable output. To work, myzen must be the theme's base prefix, though; if the base prefix is myzen_theme and the function name is myzen_more_link(), then it doesn't work. – kiamlaluno Mar 31 '11 at 0:25
Latest version of these functions are at link – drumped Apr 7 '11 at 17:55
Please note that this answer is incorrect as cache was cleared. – drumped Apr 28 '11 at 22:04
feedback

First you should to declare onw theme element 'more_link'

function mymodule_theme(){
  return array(
    'more_link' => array(
      'arguments' => array('url' => NULL, 'title' => NULL)
    )
  );
}

function mymodule_more_link($url, $title) {
  watchdog("template.php","myzen_more_link");
  return '<div class="more-link">' . 
    t('<a href="@link" title="@title">( more ... )</a>', 
    array('@link' => check_url($url), 
    '@title' => $title)) . '</div>';
}
link|improve this answer
This is not the whole story for the zen theme. I note above that this is the solution for a module doing theming; however, the zen sub-theme item - Implementation of HOOK_theme has a comment: // @TODO: Needs detailed comments. Patches welcome! – drumped Mar 31 '11 at 10:21
Continuing -- In that function we have: function myzen_theme(&$existing, $type, $theme, $path) { $hooks = zen_theme($existing, $type, $theme, $path); to which I added $hooks['more_link'] = array( 'arguments' => array('url' => NULL, 'title' => NULL) ); – drumped Mar 31 '11 at 10:28
The function zen_theme returns an empty array so it clearly is not using this mechanism for its own example of sub-theming - zen_breadcrumb. I am still missing something obvious here, needless to say, my theme function myzen_more_link is never called. – drumped Mar 31 '11 at 10:38
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.