Is there a way to change the order of the "read more", "print-friendly", etc. links at the bottom of a Drupal page? Right now, read more shows up after the other links. I also have some social bookmarking links, etc. that I'd like to move to another position.
We Rock Your Web Forum » Content Management Systems » Drupal
Drupal - Re-order Inline Links?
(2 posts)-
Posted 1 year ago #
-
Posted 1 year ago
-
There is. The method depends on the version of Drupal you're using. For Drupal 6.x, simply add the following PHP script to your theme's template.tpl.php file:
<?php
/*
* See http://drupal.org/node/44435 for more
*/
function reorder_links($links, $first_keys = array(), $last_keys = array()) {
$first_links = array();
foreach ($first_keys as $key) {
if (isset($links[$key])) {
$first_links[$key] = $links[$key];
unset($links[$key]);
}
}
$links = array_merge($first_links, $links);
$last_links = array();
foreach ($last_keys as $key) {
if (isset($links[$key])) {
$last_links[$key] = $links[$key];
unset($links[$key]);
}
}
$links = array_merge($links, $last_links);
return $links;
}
/*
* To re-order the $links array, we override theme_links()
*/
function phptemplate_links($links, $attributes = array('class' => 'links')) {
$links = reorder_links($links, array('comment_add', 'forward_links','print_pdf'), array('last-link'));
return theme_links($links, $attributes);
}
?>Add the CSS attribute of your link element to the $links array above to have it re-ordered. We added some sample elements to illustrate.
Posted 1 year ago #