How to disable JetPack Carousel on one page

I have the Tiled Galleries and Carousel features enabled in JetPack.

On one page (ie. the home page), I’d like to override the Carousel behaviour and link the (tiled gallery) images to a custom URL instead of having the clicked image open in a carousel.

  • Johnnie
    • WPMU DEV Initiate

    Thanks for your reply!

    Apparently, JetPack has a filter for this kind of thing: jp_carousel_maybe_disable.

    I’ve written a small plugin and added it to this post. It’s way too specific to submit as a real plugin, but who knows it might help someone. :slight_smile:

    <?php
    /**
    * Plugin Name: Disable Jetpack Carousel on homepage
    * Description: Disables Jetpack Carousel on homepage.
    * Version: 1.0.0
    * Author: Johnnie
    * License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    */

    // No direct access
    if ( ! defined( 'ABSPATH' ) ) exit;

    /**
    * Disable Jetpack Carousel on homepage
    *
    * @since 1.0
    * param bool $value Current state of Carousel enablement
    * @return bool True if homepage detected, to disable Carousel
    */
    function djcoh_disable_carousel( $value ) {

    // Is this the front page?
    wp_reset_query();
    if ( is_front_page() ) {
    $value = true; // true to disable Carousel
    }

    // Return original or changed value
    return $value;

    }

    add_filter( 'jp_carousel_maybe_disable', 'djcoh_disable_carousel' );