SHARE
TWEET

Untitled

a guest Oct 16th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /** custom set a facet to a specfic value on FWP.reset() instead of clearing
  3.  ** change 'categories' to the name of your facet and 'post-formats' to
  4.  ** the value you want selected
  5.  **/
  6. add_action( 'wp_footer', function() { ?>
  7.     <script>
  8.     (function($) {
  9.         if ('object' !== typeof FWP) {
  10.                 return;
  11.         }
  12.         $(function() {
  13.             FWP.hooks.addAction('facetwp/reset', function() {
  14.                 FWP.facets['categories'] = ['post-formats'];
  15.             });
  16.         });
  17.     })(jQuery)
  18.     </script>
  19. <?php }, 100 );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top