I'm building a site that has thumbnail with titles... (web design request)...
How can I display the image title under each thumbnail?

Comments

marco_cruz’s picture

Answering to myself (and someone who needs it):

1. Find the file colorbox.theme.inc and open it

2. Find line 112

3. Change it from:
return l($image, $variables['path'], $options);
to
return l($image, $variables['path'], $options) . $variables['title'] ;

frjo’s picture

Status: Active » Closed (works as designed)

You do not want to edit the colorbox.theme.inc directly. It will make upgrading the module a hassel.

What you do is copy the theme_colorbox_imagefield() function to the template.php file in your theme, rename it to nameofmytheme_colorbox_imagefield() and make the changes you want there.

Now you can upgrade the Colorbox module as normal and your customisation is safe in the template.php file.

This is how you override any theme function.

jonodunnett’s picture

For me the function to modify was theme_colorbox_imagefield($variables). If I directly hack the Colorbox module then it works as intended (titles now show) but if I copy the function to template.php in my theme then I get an error:
"Fatal error: Cannot redeclare theme_colorbox_imagefield() (previously declared in C:\wamp\www\D7\sites\all\themes...."
Any ideas what the problem is? if possible I would prefer to do things the right way and not hack outside of my theme folder...
Useful fix though, thanks!

elianm’s picture

Very useful, thanks for the solution.