WordPress.org

Forums

jQuery Colorbox
[resolved] Colorbox and NextGEN pagination (II) - SOLVED (2 posts)

  1. kalshyre
    Member
    Posted 2 years ago #

    I had the similar issue as described on this thread 'Colorbox and Nextgen pagination'

    Loading all images in the modal window in NextGEN gallery (in NGG>options) works, except when used in combination with Colorbox and NGG gallery pagination. It makes it very annoying to have to leave the colorbox, go to page 2 and re-open the colorbox.
    In order to have gallery pagination enabled but still all the images loaded in the modal window / colorbox, a fix is needed.

    The fix proposed in the thread above could be improved in several ways (and work with no change to the display - Mattki wants only ONE thumbnail to show and to link to the whole gallery. Here is what I have done (and it works) :

    Diagnosis : checking with firebug shows that the 'hidden' images links are loaded, but not the <img/> tags themselves contained within. So I added a quick check (using if) and add 'display:none' for the img tags of the hidden images.

    Steps : create a copy of /plugins/nextgen-gallery/view/gallery.php into your child-theme in /nggallery/gallery.php (no need to rename it, hence there will be no need to change the shortcode in the posts/pages).

    in line 42 (the editing of the link), change this part

    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
    	<?php if ( !$image->hidden ) { ?>
    		<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
    	<?php } ?>
    </a>

    into

    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
    	<?php if ( !$image->hidden ) { ?>
    		<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
    	<?php } ?>
    
    	<?php if ( $image->hidden ) { ?>
    		<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> style="display:none;"/>
    	<?php } ?>
    </a>

    See the result here : http://xiaowei.fr/en/landscapes/

    There will be no problem when upgrading the plugin as this file is in the child theme. The name is the same as the original one, so the shortcode will be the same.
    NB: there is no manual addition of class=colorbox-XX so this fix should work for other lightbox plugins as well (unlike the fix mentionned by Mattki)

    using WP 3.4.1, NextGEN 1.9.6, Suffusion theme 4.3.0, qTranslate 2.5.31 (& qTranslate slug), and 10 other plugins.

    Hope this can help some ! Perhaps a WP moderator can add a link to this thread on the other one (where many searches about this bug end up)

    http://wordpress.org/extend/plugins/jquery-colorbox/

  2. techotronic
    Member
    Plugin Author

    Posted 2 years ago #

    now that's a good solution, thanks for sharing!
    And I see that you modified the CSS so that your Colorbox theme matches your site :-)
    Cheers,
    Arne

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • jQuery Colorbox
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic