Created
February 5, 2014 00:43
-
-
Save thomasgriffin/8815376 to your computer and use it in GitHub Desktop.
Disables lightbox functionality for a specific gallery ID.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'envira_gallery_pre_data', 'tgm_envira_disable_lightbox', 10, 2 ); | |
function tgm_envira_disable_lightbox( $data, $gallery_id ) { | |
// You can target this by specific ID if you want. If you want this for all galleries, just remove this line. Change 324 to your gallery ID. | |
if ( 324 !== $gallery_id ) { | |
return $data; | |
} | |
// Empty the link field for each image. | |
foreach ( (array) $data['gallery'] as $id => $item ) { | |
if ( ! empty( $data['gallery'][$id]['link'] ) ) { | |
unset( $data['gallery'][$id]['link'] ); | |
} | |
} | |
// Return the modified data. | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment