• Resolved Dvd709

    (@dvd709)


    Hi,

    I’ve been trying to combine the two plugins although it hasn’t gone well, i’m only have issues while trying to get it to work on NGG.

    Now Simple Lightbox has this function named “slb_activate()” which works perfectly fine on other instances such as Advances custom fields, it’s supposed to force the wrapper around any piece of content it hasn’t been able to by just installing the plugin.

    So i’ve been trying to use this function on NextGen Gallery although it doesn’t like to work together with it.

    I of course can’t use it on the default template/custom tempalte file because that’d mean i’d break the URL’s since it works on one page so I had to go to the root of it which is custom-gallery.php(inside the theme).

    I’ve tried the following on gallery.php:

    <!-- Thumbnails -->
        <?php $i = 0;  ?>
        <?php foreach ( $images as $image ) : ?>
    
        <div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
        	<div class="ngg-gallery-thumbnail" >
        			<?php if ( !$image->hidden ) {
        			$test = "<img title=" . esc_attr($image->alttext) . " alt=" . esc_attr($image->alttext) . " src=" . nextgen_esc_url($image->thumbnailURL) . " " . $image->size . "/>" ?>
        			<?php echo slb_activate($test); } ?>
        	</div>
        </div>

    As you could see I’ve removed the standard as well as turning off effects in the plugin settings, yet this only returns me images as they are without wrapping it in a . I can’t wrap my mind around why this is so.

    So my question is:
    How can I wrap the ‘slb_activate()’ function around NextGen Gallery’s content.

    Side Note: These galleries are inside the standard wisywig so not a custom field.

    Sorry if I forgot anything.

    https://www.ads-software.com/plugins/simple-lightbox/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Archetyped

    (@archetyped)

    Hi, SLB works with links to images (i.e. something that a visitor can click on). Your code sample above is not generating any links, so SLB has nothing to activate.

    Wrapping each thumbnail in a link that points to the full-size image will allow SLB to activate the link. See SLB’s beginner’s guide for more information.

    Thread Starter Dvd709

    (@dvd709)

    So you mean it has to be wrapped in an and then I should wrap that in a variable and then use it on slb_activate?

    So for example(with no href or value, also quoted the a’s so it won’t be a link here on wordpress):

    $test = “<a’>'<img title=” . esc_attr($image->alttext) . ” alt=” . esc_attr($image->alttext) . ” src=” . nextgen_esc_url($image->thumbnailURL) . ” ” . $image->size . “/></ a>” ?></a’>’

    Thread Starter Dvd709

    (@dvd709)

    Actually that made me realize something, i’m indeed overthinking it haha.

    I just solved it by adding the link around it again and then put that in the same variable as img was which was $test, if anyone is wondering I did this in my custom-gallery.php
    (Be sure to concatenate the two same named variables which in my case is $test= and $test .= notice the dot) :

    <!-- Thumbnails -->
        <?php $i = 0;  ?>
    	<?php foreach ( $images as $image ) : ?>
    
    	<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
    		<div class="ngg-gallery-thumbnail" >
    			<?php $test = "<a href='" . nextgen_esc_url($image->imageURL) . "'" .
    			   " title='" . esc_attr($image->description) . "'" .
    			   " data-src='" . nextgen_esc_url($image->imageURL) .  "'" .
    			   " data-thumbnail='" . nextgen_esc_url($image->thumbnailURL) .  "'" .
    			   " data-image-id='" . esc_attr($image->pid) .  "'" .
    			   " data-title='" . esc_attr($image->alttext) .  "'" .
                   " data-description='" . esc_attr($image->description) .  "'" .
                    $image->thumbcode . ">";
    				//echo $test;
    				?>
    				<?php if ( !$image->hidden ) {
    				$test .= "<img title=" . esc_attr($image->alttext) . " alt=" . esc_attr($image->alttext) . " src=" . nextgen_esc_url($image->thumbnailURL) . " " . $image->size . "/></a>" ?>
    				<?php } echo slb_activate($test); ?>
    		</div>
    	</div>

    Plugin Author Archetyped

    (@archetyped)

    Hi, glad you got it worked out ??

    Note that you may want to wrap the if ( !$image->hidden ) conditional around the entire link/thumbnail generation code, rather than just the thumbnail. As it is, you could end up with an empty (and thus unclickable) link.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Lightbox and NextGen Gallery’ is closed to new replies.