Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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
    Rob

    #581657

    Hi 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!
    Yigit

    #581682

    Thanks 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
    Rob

    #583594

    Hey!

    could you provide us admin access, so we can take a closer look into it? Post login details here as private reply.

    Best regards,
    Andy

    #583726

    Thanks Andy login below.

    #583981

    Hi!

    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,
    Ismael

    #584318

    Hi 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
    Rob

    #584962

    Hi Rob!

    Is the issue resolved ? what is the purpose of the above code? Please elaborate.

    Best regards,
    Vinay Kashyap

    #584967

    Hi 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
    Rob

    #586403

    Hi!

    Please add the “lightbox” class attribute to the link tag. Something like this:

    <a class="lightbox" href="'.  $image['url'].'">'
    

    Regards,
    Ismael

    #587178

    Thanks Ismael that fixed it. I tried lightbox-added but not just lightbox.
    Nice one
    Cheers
    Rob

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Lightbox from url’ is closed to new replies.