By Olivaw on
I want to add a class of 'clearfix' to the links that appear at the bottom of a node in teaser view (i.e. 'read more' and 'add new comment'.) The class needs to be added to the <ul> tag.
This is my code so far:
function bsc_theme_preprocess_node(&$variables) {
$attributes = $variables['content']['links']['#attributes'];
$attributes['class'][] = 'clearfix';
}
This code successfully adds a class of 'clearfix' to the $attributes['class'] array. However, the class does not appear within the html markup.
What more do I need to do to get the clearfix class to be output?
Thanks.
Comments
sub
sub
Dreamleaf Media
If anyone cares there are two
If anyone cares there are two ways of doing this:
(1) put the following function into your template.php:
(2) Overriding theme_links(). I happened to come across the following post:
And indeed if you use the following code in your template.php it will add a class of clearfix to the
<ul>but only for theme_links that appear in the node part of the page. I've commented where I made a change: