Replacing a 'read more' node link
abrabapupa - June 15, 2009 - 22:12
Hello there,
i found that it's nearly impossible to alter the 'read more' link (line when displaying node teaser).
I want to simply replace it with nice image and title, instead of a textual link.
I tried to implement following functions in my template.php file:
mythemename_link(..) - never called
mythemename_link_alter() - same
the only hook which is available is
mythemename_links()
but altering a link in this function is a bit awkward
function mythemename_links($links, $attributes = array('class' => 'links')) {
if (isset($links['node_read_more']))
{
$links['node_read_more'] = ....
}
return theme_links($links, $attributes);
}is there a more elegant way?

what about the read more link
what about the read more link are you trying to change?
-Corey
- Corey
...
Yes, there is a much more elegant way, Image Replacement - http://adaptivethemes.com/use-icons-for-node-and-comment-links
IR preserves the text for accessibility and SEO and is a lightweight CSS only solution, no PHP required.
Note that my sites site_name also uses an image replacement technique.
Professional Drupal Design and Theme Services
CSS-only text replacement is not always an option
When you need to display icons inline, a CSS text replacement is not quite appropriate solution. Not saying, that this solution fits only for simplest forms - replacing a link text with image. What if i want to display an icon + text? Or make some links to open in a new page etc.
So, i asking second time: is there a more elegant way to modify a way how links markup generated by theme?
If you are wanting to replace
If you are wanting to replace the text completely, you can always try the String Overrides module.
-Corey
- Corey
...
icon + text = background image + padding.
open in new window is a link attribute or js behaviour, nothing to do with what you asked originally.
"a CSS text replacement is not quite appropriate solution", yeah, whatever man, you stick to that ok.
/dev/null
Professional Drupal Design and Theme Services
...
sure thing, but i cannot predict what customer/designer might want to put there next time. This is why i want a most generic solution. And what is you proposed is very limited one.
P.S. I really wonder, why do i need to use CSS hacks, when i have a direct access to all sources and can modify markup in any way i want it to be.
ed_readmore module
Have you tried using http://drupal.org/project/ed_readmore module yet?
tcvn
Where I work http://www.ichanoi.com/
Just what i looking
Thanks for pointer!
This is yet another thing which i wanted to fix among other things related to 'read more' link itself.