Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 3 additions & 41 deletions experimental/gpeb-lightbox.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
<?php
/**
* Gravity Perks // Entry Blocks // Lightbox
* https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
*
* A rough draft lightbox implementation for Entry Blocks!
*
* Instructions:
*
* 1. Install the Multi-file Merge Tag snippet.
* https://gravitywiz.com/customizing-multi-file-merge-tag/
*
* 2. Copy and paste this snippet into your theme's functions.php or wherever you include custom PHP.
*
* 3. That's it. 😉
* We're no longer using the experimental folder for experimental snippets. 🚧
* You can now find the snippet here:
* https://github.com/gravitywiz/snippet-library/blob/master/gp-entry-blocks/gpeb-lightbox.php
*/
add_action( 'wp', function() {
if ( is_callable( 'gw_multi_file_merge_tag' ) && has_block( 'gp-entry-blocks/entries' ) ) {
gw_multi_file_merge_tag()->register_settings( array(
'markup' => array(
array(
'file_types' => array( 'jpg', 'jpeg' ),
'markup' => '<div class="gpeb-image"><a href="{url}" class="gpep-image-link"><img src="{url}" width="100%" /></a></div>',
),
),
) );
wp_enqueue_script( 'magnific', 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
wp_enqueue_style( 'magnific', 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css', array(), '1.1.0' );
add_action( 'wp_footer', function() {
?>
<script>
jQuery( document ).ready( function( $ ) {
$( '.gpep-image-link' ).magnificPopup({
type: 'image',
gallery: {
enabled: true
}
});
});
</script>
<?php
} );
}
} );
Loading