Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ericakfranz/8814aa276bc5087d7d4b to your computer and use it in GitHub Desktop.
Save ericakfranz/8814aa276bc5087d7d4b to your computer and use it in GitHub Desktop.
Register a click handler to reload Envira Gallery layouts. Useful when an Envira Gallery isn't visible on page load.
<?php
/**
* Plugin Name: Envira Gallery - Reload Enviratope on Page Load
* Plugin URI: http://enviragallery.com
* Version: 1.0
* Author: Erica Franz
* Author URI: https://fatpony.me/
* Description: Reload Envira Gallery layouts when page finishes loading.
*/
/**
* Reload Enviratope on page load
*/
function envira_gallery_reload_enviratope( $data ) {
?>
// Reload gallery when page finishes loading
$(document).load(function(){
envira_gallery['<?php echo $envira_gallery_data_id; ?>'].init();
});
<?php
}
add_action( 'envira_gallery_api_enviratope', 'envira_gallery_reload_enviratope' );
<?php
/**
* Plugin Name: Envira Gallery - Reload Enviratope on Click
* Plugin URI: http://enviragallery.com
* Version: 1.0
* Author: Tim Carr
* Author URI: http://www.n7studios.co.uk
* Description: Register a click handler to reload Envira Gallery layouts. Useful when an Envira Gallery isn't visible on page load.
*/
/**
* Reload Enviratope on item click
*/
function envira_gallery_reload_enviratope( $data ) {
?>
// Modify '.responsive-tabs__list__item' to the class or id of your tab output
$('.responsive-tabs__list__item').on("click", function(e) {
envira_gallery['<?php echo $envira_gallery_data_id; ?>'].init();
});
<?php
}
add_action( 'envira_gallery_api_enviratope', 'envira_gallery_reload_enviratope' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment