Skip to content

Commit 5769b57

Browse files
authored
gpeb-lightbox.php: Migrated from experimental folder.
1 parent e21b59b commit 5769b57

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

gp-entry-blocks/gpeb-lightbox.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Entry Blocks // Lightbox
4+
* https://gravitywiz.com/documentation/gravity-forms-entry-blocks/
5+
*
6+
* Experimental Snippet 🧪
7+
*
8+
* A rough draft lightbox implementation for Entry Blocks!
9+
*
10+
* Instructions:
11+
*
12+
* 1. Install the Multi-file Merge Tag snippet.
13+
* https://gravitywiz.com/customizing-multi-file-merge-tag/
14+
*
15+
* 2. Copy and paste this snippet into your theme's functions.php or wherever you include custom PHP.
16+
*
17+
* 3. That's it. 😉
18+
*/
19+
add_action( 'wp', function() {
20+
if ( is_callable( 'gw_multi_file_merge_tag' ) && has_block( 'gp-entry-blocks/entries' ) ) {
21+
gw_multi_file_merge_tag()->register_settings( array(
22+
'markup' => array(
23+
array(
24+
'file_types' => array( 'jpg', 'jpeg' ),
25+
'markup' => '<div class="gpeb-image"><a href="{url}" class="gpep-image-link"><img src="{url}" width="100%" /></a></div>',
26+
),
27+
),
28+
) );
29+
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 );
30+
wp_enqueue_style( 'magnific', 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css', array(), '1.1.0' );
31+
add_action( 'wp_footer', function() {
32+
?>
33+
<script>
34+
jQuery( document ).ready( function( $ ) {
35+
$( '.gpep-image-link' ).magnificPopup({
36+
type: 'image',
37+
gallery: {
38+
enabled: true
39+
}
40+
});
41+
});
42+
</script>
43+
<?php
44+
} );
45+
}
46+
} );

0 commit comments

Comments
 (0)