This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $(document).on('facetwp-loaded', function() { | |
| var in_use = false; | |
| // see if any facets are in use | |
| $.each(FWP.facets, function(name, val) { | |
| if (val.length > 0) { | |
| in_use = true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add to your (child) theme's functions.php and re-index afterwards! | |
| add_filter( 'facetwp_index_row', function( $params, $class ) { | |
| if ( 'recognition' == $params['facet_name'] ) { | |
| $new_params = $params; | |
| $label = $params['facet_display_value']; | |
| if ( false !== strpos( $label, 'National Winner' ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add to your (child) theme's functions.php | |
| add_filter( 'facetwp_settings_admin', function( $settings, $class ) { | |
| $settings['general']['fields']['prefix'] = [ | |
| 'label' => __( 'URL prefix', 'fwp' ), | |
| 'html' => $class->get_field_html( 'prefix', 'dropdown', [ | |
| 'choices' => [ 'fwp_' => 'fwp_', '_' => '_' ] | |
| ] ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add the following to your (child) theme's functions.php | |
| add_action( 'wp_footer', function() { | |
| ?> | |
| <script> | |
| (function($) { | |
| if ( 'undefined' !== typeof FWP ) { | |
| FWP.hooks.addFilter('facetwp/set_options/date_range', function(flatpickr_opts, extras) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add the following to your (child) theme's functions.php and re-index afterwards | |
| add_filter( 'facetwp_index_row', function( $params, $class ) { | |
| if ( 'gewicht' == $params['facet_name'] ) { | |
| $params['facet_value'] = $params['facet_display_value']; | |
| } | |
| return $params; | |
| }, 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'facetwp_index_row', function( $params, $class ) { | |
| if ( in_array( $params['facet_name'], [ 'facet_2', 'facet_3', 'facet_4', 'facet_5' ] ) ) { | |
| $params['facet_name'] = 'facet_1'; | |
| } | |
| return $params; | |
| }, 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| (function($) { | |
| $(document).on('facetwp-loaded', function() { | |
| var in_use = ('' != FWP.build_query_string()); | |
| $('.your-reset-btn').toggleClass('hidden', ! in_use); | |
| }); | |
| })(jQuery); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'facetwp_sort_options', function( $options, $params ) { | |
| $options['points_desc'] = [ | |
| 'label' => 'Points (Highest)', | |
| 'query_args' => [ | |
| 'orderby' => [ 'date' => 'ASC', 'meta_value_num' => 'DESC' ], | |
| 'meta_key' => 'points' | |
| ] | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add to your (child) theme's functions.php | |
| add_filter( 'gettext', function( $translated_text, $text, $domain ) { | |
| if ( 'fwp-front' == $domain ) { | |
| if ( 'Min' == $translated_text ) { | |
| $translated_text = 'Min (translated)'; | |
| } | |
| elseif ( 'Max' == $translated_text ) { |