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


Note :This snippet works only with the Classical style option. The Classical style option can be enabled in Appearance > Customize > Advanced > Theme Style. More about the theme style option here


Hi!

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.

customizr-fancybox-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


We can help you to implement this snippet

Coding is our job and we know WordPress inside and out. We can help you to customize your website with small chunks of code snippets like this one.

Send us your request and we'll get back to you quickly.



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.