apply_filters ( 'jp_carousel_add_data_to_container', array $extra_data )

Filter the data added to the Gallery container.

Source file: modules/carousel/jetpack-carousel.php

View in GitHub

Parameters

$extra_data

(array) Array of data about the site and the post.


Changelog

Since: Jetpack 1.6.0


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');

Have a question about this article?

Comments are currently closed for this article, but rest assured we're still here to help! Send us a message and we'll get back to you.

Contact us