In the comment.tpl, $links is printed to show the reply and edit link. In my theme, edit comes before reply. How do you change the order of the printed links?
A:
Try creating a comment preprocess function in template.php in your theme. That should give you access to the $links variable and allow you to re-order the elements.
stevec
2010-07-23 23:11:33
Good idea. I tried using unset ($links['comment_reply']); in the preprocess function, but it didn't work.
Toxid
2010-07-24 11:13:35
A:
Check out hook_link_alter()
- it allows you to manipulate the links before they get rendered, e.g. remove some or change the order.
Henrik Opel
2010-07-25 17:12:35
A:
This function will reverse the order of comment links. Put it in your template.php (also after adding the function empty your site caches and visit /admin/build/themes once to make sure this function is picked up in the theme registry):
function phptemplate_links($links, $attributes = array('class' => 'links')) {
if (isset($links['comment_edit'])) {
krsort($links); // or ksort if you want to order your links the other way
}
return theme_links($links, $attributes);
}
dazweeja
2010-07-28 00:51:10