Hi, I'm trying to install the fancybox 3.0 on my wordpress page, but I can not add the data-fancybox=
attribute for the images or galleries that wordpress creates from the entries.
Before, I had the easy fancybox plugin but I decided to remove it, because it loads too many scripts and the page goes slower. With this plugin I got that when I selected in the link of the image as multimedia file I recognized these as fancybox links and I opened them in the pop-up, I could also choose what types of files I wanted to open. ..
I have only added the libraries
jquery.fancybox.min.css and jquery.fancybox.min.js
I get to recognize them for the galleries that I create manually, because I can add the attribute data-fancybox="images"
to the button.
This is the page that works well , The images that you open are the examples of web pages below.
On the other hand, in this other , which is an entry, I can not get it done automatically, because I got it with the galleries with the code I leave afterwards, but in the single images nothing, I could add the attribute manually, but in the galleries I can not find the way.
In the fancybox 3.0 page I can not find it, I found this script in surealcms , and I have managed to open the image galleries.
Now I need you to open any image or pdf that is linked from a button <a href="... .jpg">
<a href="... .pdf">
This could be done manually, but I understand that it is most convenient to do it automatically.
$(document).ready( function() {
// Don't execute if we're in the Live Editor
if( !window.isCMS ) {
// Group images by gallery using 'data-fancybox-group' attributes
var galleryId = 1;
$('.gallery-group').each( function() {
$(this).find('a').attr('data-fancybox', 'group');
});
}
});
Thanks in advance