Extract the 'read more' link and display it separately somewhere else in your nodes

Last modified: July 16, 2007 - 04:37

description

Note: for 4.7 and 5.x this can be done using the Read More Tweak module.

To take the 'read more' link out of the links below a node and place it somewhere a little more prominent, open up node.tpl.php and insert the following code at the very top.

<?php
// Extract "read more" link from $links so we can display it separately.
if (preg_match('!<a[^>]+>'.t('read more').'</a>!', $links, $match)) {
 
$links = preg_replace('!\| <a[^>]+>'.t('read more').'</a>!', '', $links);
 
$more = '<span class="readmore">'. $match[0] . '</span>';
}
else {
 
$more = '<span class="readmore-fill"></span>';
}
?>

Then, where you want to display the 'read more' link, place the following line:

<?php
if ($more): print $more; endif;
?>

 
 

Drupal is a registered trademark of Dries Buytaert.