Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By RoryBreaker on
I cannot figure out how to style the primary links. I am using the Foundation theme to create a custom theme, and I simply want to add a class attribute to the anchor tag of the primary links items. I have looked in the template files, style sheet, phpTemplate handbooks and searched the forums but without any luck. Any ideas? Thanks.
- Tyson
Comments
Use PHP to replace strings
Insert 'class="MyClass"' into a link using str_replace function in your theme before primary link output.
But if you want to add the same class to all links it is better to use CSS cascading:
class and unique id on Primary Links
Hi Tyson,
quite a bit of this is covered at http://drupal.org/node/44704
You might get more help there.
This is what I'm using in page.tpl.php but I'm sure there's a cleaner way of including in template.php
It also generates a unique id as well as a class.
Also look at http://2bits.com/articles/adding-unique-styles-to-primary-and-secondary-...