[SOLVED][Drupal Colorbox] How to use Alt text instead of Title text in Colorbox?

| | 1 min read

Many Drupal users wanted to know how to use alt text instead of title text in Colorbox?. If you are looking for a way to do that in your Drupal installation then read on to find out the solution.

Here is the solution.

  • If the title tag of the image is empty then Colorbox will automatically display the text in the alt tag.
  • However if you want to always use the alt tag text then you have to use theme_colorbox_imagefield() function in the template.php file of your theme. Follow the steps below to do that.
    • Copy theme_colorbox_imagefield() from the colorbox.theme.inc file and change
    • 'title' => $variables['title'],

      to

      'title' =>  $variables['image']['alt']
    • After doing that do not forget to clear the theme cache to make the changes take affect.

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.