Title: Url inside slideshow
Last modified: September 30, 2021

---

# Url inside slideshow

 *  Resolved [Stathi](https://wordpress.org/support/users/stathi/)
 * (@stathi)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/url-inside-slideshow/)
 * I love fancybox.
    Is there a way I can pass a distinct url to each slide that
   can be clicked inside the sideshow and take the user there?
 * I have a script which creates a slideshow of all my WordPress posts images. I
   want the user to be able to go to the particular post in which the image belongs.
 * Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [Stathi](https://wordpress.org/support/users/stathi/)
 * (@stathi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-14985338)
 * Hi friends. It has been a couple of weeks and I am checking to see if this is
   possible. Can you help? Thank you so much.
 *  Plugin Support [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * (@beatrice12)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-14988071)
 * Hello [@stathi](https://wordpress.org/support/users/stathi/),
 * Thank you for reaching out to us!
 * We already responded to your question here: [https://wordpress.org/support/topic/url-to-start-slideshow/](https://wordpress.org/support/topic/url-to-start-slideshow/)
 * Warmly,
    Beatrice.
 *  Thread Starter [Stathi](https://wordpress.org/support/users/stathi/)
 * (@stathi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-14988919)
 * Hi Beatrice. Thank you for your message.
 * That post is about something else that was indeed resolved. However, this topic
   is different. Please read the description at the top. It would be so wonderful
   if it could happen. I will try to rephrase it.
 * I need to pass a URL to each slide so that as the users go through the slideshow
   and they find an image interesting, that they could click a button or link on
   the slide and take them there.
 * Thank you so much.
 *  Plugin Support [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * (@beatrice12)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-15003261)
 * Hello [@stathi](https://wordpress.org/support/users/stathi/),
 * Can you please send us the link of the site and the initialization code of Fancybox?
 * Thank you,
    Beatrice.
 *  Thread Starter [Stathi](https://wordpress.org/support/users/stathi/)
 * (@stathi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-15010318)
 * Hi Beatrice. I am still developing my site, mexas.org, as well as my son’s. I
   use the plain vanilla fancybox package that I downloaded. You can see it in the
   page source.
 * This is what I want.
 *     ```
       <a href="image.jpg" data-fancybox 
       data-caption="Caption for image"
       link=“www.someurl.com/somepage”>
       <img src="thumbnail.jpg" alt="" />
       </a>
       ```
   
 * So that when I am in the slideshow and I see an image I like, I can click on 
   a link or button, inside the slideshow pop up, to take me to the passed link.
 * Is this possible?
    -  This reply was modified 4 years, 7 months ago by [Stathi](https://wordpress.org/support/users/stathi/).
    -  This reply was modified 4 years, 7 months ago by [Stathi](https://wordpress.org/support/users/stathi/).
 *  Thread Starter [Stathi](https://wordpress.org/support/users/stathi/)
 * (@stathi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-15017175)
 * I figured it out. I will modify the code for adding a facebook button and registering
   a new attribute in .
    Thank you.
 *  Thread Starter [Stathi](https://wordpress.org/support/users/stathi/)
 * (@stathi)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-15017344)
 * After HOURS of research, this is my complete wordpress fancybox handling.
 *     ```
       add_action('wp_head', 'fancybox_init'); 
       function fancybox_init() {
       ?>
   
       <script type="text/javascript">
       jQuery(document).ready(function($){	
       	var select = $('a[href$=".bmp"],a[href$=".gif"],a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".BMP"],a[href$=".GIF"],a[href$=".JPG"],a[href$=".JPEG"],a[href$=".PNG"]'); // select image files
       	select.attr('data-fancybox-group', 'gallery');
       	select.attr('class', 'fancybox'); 
       	select.fancybox();	
   
       ///////////make 'go' button and go to this page //////////
   
       $.fancybox.defaults.btnTpl.go = '<button data-fancybox-go class="fancybox-button fancybox-button--go" title="go to this page">'+"go"+'</button>';
   
       $('body').on('click', '[data-fancybox-go]', function() {
       var linx=$.fancybox.getInstance().current.opts.$orig.data('item');
       window.location.href = linx;
       });
   
       //////////////////// init fancybox //////////
   
       $(".fancybox").fancybox({
   
       beforeShow: function () {
                this.title = $(this.element).find("img").attr("alt"); }, 
       		thumbs : {autoStart : true, axis : 'x'},
       		loop       : true,
       		padding :0,
       		buttons: ["go", "zoom", "share", "slideShow", "fullScreen", "download", "thumbs", "close" ],
       		margin  : 20, 
       		wrapCSS    : '',
       		openEffect : 'elastic',
       		openSpeed  : 650,
                       arrows    : true,
       	   	closeEffect : 'elastic',
                       closeSpeed  : 650,
                      	closeBtn  : true,
       		closeClick : false,
       		nextClick  : false,
       		prevEffect : 'elastic',
       		prevSpeed  : 650,
       		nextEffect : 'elastic',
       		nextSpeed  : 650,
       		pixelRatio: 1, // Set to 2 for retina display support
       	     	autoSize   : true,
       		autoHeight : false,
       		autoWidth  : false,
       		autoResize  : true,
       		fitToView   : true,
       		aspectRatio : false,
       		topRatio    : 0.5,
       		leftRatio   : 0.5,
       		scrolling : 'auto', // 'auto', 'yes' or 'no'
       		mouseWheel : true,
       		autoPlay   : false,
       		playSpeed  : 3000,
       		preload    : 3,
       		modal      : false,
                  helpers : {
       	        title : {
       		     type : 'inside', // outside
       			}
       		}
       	});		
   
       //////////////////////
   
       $(".fancybox-media")
       	.fancybox({
       		openEffect : 'none',
       		closeEffect : 'none',
       		prevEffect : 'none',
       		nextEffect : 'none',
       	        arrows : false,
       	helpers : {
       		media : {},
       		buttons : {}
       		}
              });
   
       //////////////////////
       });
       ```
   
 * I passed the link I want to redirect to, here using data-item:
 *     ```
       <a href="https://mywebsite.com/img1.jpg"  data-fancybox="gallery" data-item="https://whereIwantToGo.com" class="img-fluid" data-caption="image caption"><img  src="https://mywebsite.com/img1.jpg" alt=""></a>
       ```
   
    -  This reply was modified 4 years, 7 months ago by [Stathi](https://wordpress.org/support/users/stathi/).
    -  This reply was modified 4 years, 7 months ago by [Stathi](https://wordpress.org/support/users/stathi/).
 *  Plugin Support [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * (@beatrice12)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-15024745)
 * Hello [@stathi](https://wordpress.org/support/users/stathi/).
 * I’m glad that you sorted it out and everything works fine now! We will mark this
   issue as resolved for now and please do not hesitate to reach back to us anytime
   you need!
 * Warm regards,
    Beatrice.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Url inside slideshow’ is closed to new replies.

 * ![](https://ps.w.org/fancybox-for-wordpress/assets/icon-256x256.jpg?rev=1864321)
 * [FancyBox for WordPress](https://wordpress.org/plugins/fancybox-for-wordpress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/fancybox-for-wordpress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/fancybox-for-wordpress/)
 * [Active Topics](https://wordpress.org/support/plugin/fancybox-for-wordpress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fancybox-for-wordpress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fancybox-for-wordpress/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/url-inside-slideshow/#post-15024745)
 * Status: resolved