3

I have a quicktabs instance that shows lists of content by year (2012, 2011, 2010 and so on). Each tab is a views generated block that pulls content by date using relative values (current year, current year-1, etc.). How can I override the title of each of the tabs so that I don´t have to hardcode year values as tabs titles? Thanks in advance.

0

1 Answer 1

3

I finally got this to work by adding on my template.php:

function YOURTHEME_quicktabs_alter($quicktabs) { 
if ($quicktabs->machine_name == 'YOUR_QTABS_NAME') { 
  $currYear = date('Y'); 
  for ($i = 0; $i <= 3 ; $i++ ) { 
    $yr = ($currYear-$i); 
    $quicktabs->tabs[$i]['title'] = t($yr); 
  } 
} 

} }

1
  • 1
    You don't need to add it to a theme; you can add that code in a custom module.
    – Yuseferi
    Commented May 21, 2012 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.