Skip to content

Instantly share code, notes, and snippets.

@rayrutjes
Created January 26, 2018 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rayrutjes/0c7a7082a3d2195294d40eff88d9cc19 to your computer and use it in GitHub Desktop.
Save rayrutjes/0c7a7082a3d2195294d40eff88d9cc19 to your computer and use it in GitHub Desktop.
Display instantsearch on all pages in Algolia WooCommerce plugin
<?php
add_filter( 'algolia_wc_should_display_instantsearch', function( $should_display ) {
// If configuration already considers it should be shawn, show it.
if ( $should_display ) {
return true;
}
// Detect the current page and only return true when you want instantsearch.js to be injected.
if ( is_shop() ) {
// Only for the main shopping page.
return true;
}
return false;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment