• Hi,
    I defined a gallery on an error page for which gallery is defined inside the theme template (error template) and the gallery doesn’t works (css and js not loaded.)
    All other galleries perfectly works.
    This is probably related to not adding the gallery in some content (not existing for the error page).
    Does anyone has a solution to modify this function?

    function enqueue_assets() {
    
    	/**
    	 * Filters whether baguettebox assets have to be enqueued.
    	 *
    	 * @since 1.11
    	 *
    	 * @param bool  $value  Whether baguettebox assets have to be enqueued.
    	 */
    	$baguettebox_enqueue_assets = apply_filters( 'baguettebox_enqueue_assets',
    		has_block( 'core/gallery' ) ||
    		has_block( 'core/image' ) ||
    		has_block( 'core/media-text' ) ||
    		get_post_gallery() ||
    		has_block( 'coblocks/gallery-masonry' ) ||
    		has_block( 'coblocks/gallery-stacked' ) ||
    		has_block( 'coblocks/gallery-collage' ) ||
    		has_block( 'coblocks/gallery-offset' ) ||
    		has_block( 'coblocks/gallery-stacked' )
    	);
    
    	if ( $baguettebox_enqueue_assets ) {
    		wp_enqueue_script( 'baguettebox' );
    		wp_enqueue_style( 'baguettebox-css' );
    	}
    }*
    

    Possible workaround: force loading css and js in my theme; but this is not an elegant solution…
    Regards, Christophe

  • The topic ‘gallery defined in a template issue’ is closed to new replies.