Filter the data added to the Gallery container.
Parameters
- $extra_data
array Array of data about the site and the post.
Changelog
- Introduced in Jetpack 1.6.0
How to use this hook
Notes
You can use this filter to prevent image galleries from opening in a carousel on a specific post/page. Just replace the post ID in the snippet below with the ID of your post/page.
function cl_tweak_carousel( $extra_data ) {
global $post;
if ( $post->ID == 23 ) {
$extra_data = array();
}
return $extra_data;
}
add_filter( 'jp_carousel_add_data_to_container', 'cl_tweak_carousel');
If you want to do the same for multiple posts, you can use an array of post IDs instead, as shown:
function cl_tweak_carousel( $extra_data ) {
global $post;
$ids = array( 23,62 );
if ( in_array( $post->ID, $ids ) ) {
$extra_data = array();
}
return $extra_data;
}
add_filter( 'jp_carousel_add_data_to_container', 'cl_tweak_carousel');