Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Forked from djrmom/custom-hooks.php
Last active September 16, 2020 18:10
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 mgibbs189/aa86f510e230416041d250d9249aa853 to your computer and use it in GitHub Desktop.
Save mgibbs189/aa86f510e230416041d250d9249aa853 to your computer and use it in GitHub Desktop.
facetwp set order of (or remove) flyout facets
<?php
// Add to your (child) theme's functions.php, or into the Custom Hooks plugin!
add_action( 'wp_head', function() {
?>
<script>
(function($) {
FWP.hooks.addFilter('facetwp/flyout/facets', function(facets) {
return ['facet3', 'facet1', 'facet2']; // change the facet display order
});
})(jQuery);
</script>
<?php
}, 100 );
@Skylinks854
Copy link

Skylinks854 commented Sep 16, 2020

Unfortunately, it's not working for me. I have total 4 facets including a pager. What I want is to hide the pager from the flyout.
I have replaced facets with actual names but nothing happens, Flyout is still showing 4 facets instead of 3.
I have tried this code

<?php

// Add to your (child) theme's functions.php, or into the Custom Hooks plugin!

add_action( 'wp_head', function() {
?>
<script>
(function($) {

    FWP.hooks.addFilter('facetwp/flyout/facets', function(facets) {
        return ['categories','page_types','platform']; // change the facet display order
    });

})(jQuery);
</script>
<?php
}, 100 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment