Filter Hooks

To extend and expand the capabilities of Carousel Anything with its Carousel Posts module, filter hooks are available to customize the inner workings.

Carousel Posts Filter: gca_carousel_posts_parameters

Modify the search parameters for WP_Query. These parameters are generated by the settings specified in the [carousel_posts] shortcode.

You can use any parameters available in  WP_Query. Check the WP_Query entry in the codex for more information.

Sample usage: Display only results from specific authors:

add_filter( 'gca_carousel_posts_parameters', 'allow_only_these_authors' );

function allow_only_these_authors( $args ) {
	$args['author'] = '2,6,17,38'; // Only display posts by these authors.
	return $args;

Carousel Posts Filter: gca_carousel_posts_slide_override

Override this to create your own slide HTML instead of letting [carousel_posts] generate its own.

Sample usage: Display just the titles:

add_filter( 'gca_carousel_posts_slide_override', 'display_only_titles' );

function display_only_titles( $html, $post_id ) {
	$title = get_the_title( $post_id );
	return '<h1>' . $title . '</h1>';

Carousel Posts Filter: gca_carousel_posts_image_size

Override this to adjust the size of the images outputted by [carousel_posts]. The size is full by default.

Sample usage: Display square images:

add_filter( 'gca_carousel_posts_image_size', 'use_square_images' );

function use_square_images( $size ) {
	// $size is 'full' by default.
	return array( 400, 400 );

Tip: For more advanced users, you can also use with gca_carousel_posts_image_size to serve different images for different devices.