Can somebody please indicate me how to change, if possible, the link title "Read the rest of this posting" without touching the core.
This line is in the node_link function in /modules/node.module. Can I do something about it in template.php in my theme folder?

The small issue I have with this is that when testing my site to pass AA accessibility all my "read more" links have the same title and I'd like to change that so each one has a unique title.

Thanks!

Comments

michelle’s picture

http://drupal.org/project/themesettings

Michelle

--------------------------------------
My site: http://shellmultimedia.com

nancydru’s picture

hook_link_alter is specifically for doing something like this:

function pinkslip_link_alter (&$node, &$links) {
  if ($node->type != 'pinkslip') { return; } /* only do ours */
  foreach ($links AS $module => $link) {
    if (strstr($module, 'read_more')) {
      $links[$module]['title'] = variable_get('pinkslip_read_more', ">> read more...");
     }
...
}

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

johnnybegood’s picture

Thank you very much guys!

The Theme Settings module is interesting but I don't think it allows me to have a unique title for each link. For example if my article is entitled "news from UK" I'd like to have on the title link of the teaser something like: "read more news from UK". I thought here to attach the node title to the string maybe. That way all read more link titles would be different.

About using the hook, sorry for the nooby question but where should I add this? Do you mean I should write a module to implement this? Is it not possible to call this in template.php?

Once again thanks for your help.

nancydru’s picture

Yes, it needs to be a module. On the plus side, that makes it theme-independent.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

johnnybegood’s picture

Thanks for your tip Nancy. I ended up playing with hook_link and now I got what I need it. I leave the code if someone else needed it.

<?php
// $Id$

/**
 * @file
 * Creates accessible read more link titles.
 *
 * Read more links have always the same title
 * This is by default "Read the rest of this posting."
 * This module creates an unique title per read more link.
 */

/**
 * Implementation of hook_link().
 */
function accessibility_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();

  if ($type == 'node') {
    if ($teaser == 1 && $node->teaser && $node->readmore) {
      $links['node_read_more'] = array(
        'title' => t('Read more'),
        'href' => "node/$node->nid",
        'attributes' => array('title' => t('Read '.$node->title))
      );
    }
  }

  return $links;
}
johnalbin’s picture

Interesting idea: including the node title in the read more link.

We could extend that idea and allow any node meta data in the read more link.

Seeing as I’m the author of the Theme Settings module, I think I’ll add that feature to the upcoming 5.x-2.0 version.

  - John

Albin.Net : friendly web development

  - John (JohnAlbin)