-
AuthorPosts
-
February 9, 2016 at 8:37 pm #580552
Hi Can I get images to open in the Enfold theme lightbox by adding stuff to the url?
<a href="original.jpg"><img src="thum.jpg" /></a>
Thanks
RobFebruary 11, 2016 at 3:15 pm #581657Hi Rob!
You can simply add image to your page and link to image itself to open in lightbox. If that is not what you meant, please elaborate
Cheers!
YigitFebruary 11, 2016 at 3:35 pm #581682Thanks Yigit.
I have a custom post type set up
e.g. http://goldhillmuseum.org.uk/story/sidney-william-alner/
Uploaded images display as thumbnails. This is the code from my loop-index.php.$content_output .= '<div class="story-images">'; $content_output .= '<span></br><strong>Images: </br></strong></span>'; if( $images ): $content_output .= '<ul>'; foreach( $images as $image ): $content_output .= '<li>'; $content_output .= '<a href="'. $image['url'].'">'; $content_output .= '<img src="'. $image['sizes']['thumbnail'].'" alt="'. $image['alt'].'" />'; $content_output .= '</a>'; $content_output .= '</li>'; endforeach; $content_output .= '</ul>'; endif; $content_output .= '</div>';
I was hoping that within the image link I could add a class or something that opens the images in lightbox and not full size as it does now.
Cheers
RobFebruary 15, 2016 at 5:16 pm #583594Hey!
could you provide us admin access, so we can take a closer look into it? Post login details here as private reply.
Best regards,
AndyFebruary 15, 2016 at 7:43 pm #583726Thanks Andy login below.
February 16, 2016 at 9:23 am #583981Hi!
The lightbox script should automatically add the “lightbox-added” class attribute to link tags with image as src. Did you install another lightbox plugin? This simple html code is working on our installation:
<a href="imageurlhere.jpg"><img src="imageurlhere.jpg" alt="" /></a>
Best regards,
IsmaelFebruary 16, 2016 at 6:17 pm #584318Hi Ismael,
I haven’t added another lightbox plugin.
It is adding the”lightbox-added” class but it doesn’t seem to be working. This is the generated html for one thumbnail:
<a style="position: relative; overflow: hidden;" class="lightbox-added" href="http://goldhillmuseum.org.uk/wp-content/uploads/2016/01/Shaftesbury-War-Memorial-1.jpg"><img src="http://goldhillmuseum.org.uk/wp-content/uploads/2016/01/Shaftesbury-War-Memorial-1-80x80.jpg" alt=""><span style="display: none;" class="image-overlay overlay-type-image"><span class="image-overlay-inside"></span></span></a>
The only difference I can see is that it is within a custom post type called Stories. The rest of the theme functionality seems to be okay. This is the loop-index.php:$content_output .= '<div class="story-images">'; $content_output .= '<span></br><strong>Images: </br></strong></span>'; if( $images ): $content_output .= '<ul>'; foreach( $images as $image ): $content_output .= '<li>'; $content_output .= '<a href="'. $image['url'].'">'; $content_output .= '<img src="'. $image['sizes']['thumbnail'].'" alt="'. $image['alt'].'" />'; $content_output .= '</a>'; $content_output .= '</li>'; endforeach; $content_output .= '</ul>'; endif; $content_output .= '</div>';
Thanks
RobFebruary 17, 2016 at 9:41 pm #584962Hi Rob!
Is the issue resolved ? what is the purpose of the above code? Please elaborate.
Best regards,
Vinay KashyapFebruary 17, 2016 at 9:52 pm #584967Hi Vinnie,
No it is not resolved. Lightbox is not working on a custom post type within the Enfold theme. The first code is the generated html for one thumbnail. The next code is the code in loop-index that calls the images.
Sorry if I am repeating myself but I don’t know how to answer your question unless I summarize what I have already written.
Thanks
RobFebruary 20, 2016 at 6:42 am #586403Hi!
Please add the “lightbox” class attribute to the link tag. Something like this:
<a class="lightbox" href="'. $image['url'].'">'
Regards,
IsmaelFebruary 22, 2016 at 3:13 pm #587178Thanks Ismael that fixed it. I tried lightbox-added but not just lightbox.
Nice one
Cheers
Rob -
AuthorPosts
- The topic ‘Lightbox from url’ is closed to new replies.