Title: reinitialisation code?
Last modified: August 20, 2016

---

# reinitialisation code?

 *  Resolved [zawhatthe](https://wordpress.org/support/users/zawhatthe/)
 * (@zawhatthe)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/reinitialisation-code/)
 * I absolutely love this plugin. Thanks very much! Is there any way to reinitialise
   the gallery setup script once the page has loaded? I’m trying to use it with 
   an infinite scroll setup and am looking for some way to initialise the galleries
   that are loaded after the scroll that I can put into [Infinite Scroll](http://wordpress.org/extend/plugins/infinite-scroll/)‘
   s callback.
 * [http://wordpress.org/extend/plugins/good-old-gallery/](http://wordpress.org/extend/plugins/good-old-gallery/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [zawhatthe](https://wordpress.org/support/users/zawhatthe/)
 * (@zawhatthe)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/reinitialisation-code/#post-3624693)
 * I’ve hacked my way around this to get it to work. I’m sure its very messy and
   probably has some mistakes but in case its of any help to anybody else, here 
   goes:
 * 1. Modified the ‘Shortcode.class.php’ file so the line #207, the div constructor
   now reads:
 *     ```
       $ret .= '<div id="go-gallery-' . $id . '-' . $i . '" class="go-gallery-container' . $classes . '"' . $gallery_style . " data-galOpts='" . rtrim( $script, ', ' ) . "'>" . "\n";
       ```
   
 * 2. Modified the ‘good-old-gallery.php’ file so that the enqueue scripts are loaded
   unconditionally by commenting out lines 140 – 165 and simply including the following
   instead:
 *     ```
       $found = TRUE;
       add_action( 'wp_enqueue_scripts', array( $this, 'loadStylesAndScripts' ) );
       ```
   
 * 3. Included the following for the pages using Good Old Gallery:
 *     ```
       jQuery.fn.startGals = function() {
       	return this.each(function() {
       		$thisID = '#'+$(this).attr('id');
       		if ($($thisID).data('galInitiated') != 'TRUE') {
       			$opts = '{'+$($thisID).attr('data-galOpts')+'}';
       			$optsObj = eval('('+$opts+')');
       			$($thisID+' .slides').cycle($optsObj);
       			$($thisID).data('galInitiated','TRUE')
       		;
       	});
       };
       ```
   
 * 4. Put this in Infinite Scroll’s callback box:
 *     ```
       jQuery(".go-gallery-container").startGals();
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘reinitialisation code?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/good-old-gallery_4bb7c7.svg)
 * [Good Old Gallery](https://wordpress.org/plugins/good-old-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/good-old-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/good-old-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/good-old-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/good-old-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/good-old-gallery/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [zawhatthe](https://wordpress.org/support/users/zawhatthe/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/reinitialisation-code/#post-3624693)
 * Status: resolved