Setting image title (or alt attributes) as the Fancybox pop-in title

Note : the following code snippet requires advanced WordPress developer skills. There's no guarantee that this snippet works as is with the latest version of our themes, and with the latest version of WordPress. That's why you need to always test any code snippets in a staging environment before implementing it in a production site.


In Customizr (version less than 3.10), the title displayed at the bottom of the Fancybox popin is the post or page title instead of the image title.



To fix this, here’s a quick javascript snippet that displays the image title (or the alt field if there’s no title) for the FancyBox popin title.

Copy this code in your functions.php file :


 I hope this will be useful for you guys!

Your comments and improvements are welcome as always.


Related Snippets you may also like

3 thoughts on “Setting image title (or alt attributes) as the Fancybox pop-in title

  • Dario

    Customizer’s default Lightbox/Fancybox is great! However, I would like the theme to offer some simple/straightforward customizations. For instance, instead of the “img” type content I would like to use the “iframe” type. On “Image Details” I tried “Advanced Options” using class=”grouped_elements” with different rel=”tc-fancybox-group1..2.. 3…” but the fancybox pops-up always the same. Thx you in advance.

Comments are closed.