This file contains 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 | |
/* only filter product queries */ | |
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( 'product_query' != $query->get( 'wc_query' ) ) { | |
$is_main_query = false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); |
This file contains 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
/** | |
* reindex after adding or updating this filter | |
*/ | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'my_facet' == $params['facet_name'] ) { // change my_facet to name of your facet | |
$params['facet_value'] = $params['facet_display_value']; | |
} | |
return $params; | |
}, 10, 2 ); |
This file contains 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 currentcy to rate | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'my_facet_name' == $params['facet_name'] ) { // change 'my_facet_name' to name of your facet | |
$currency = get_custom_field( 'name_of_field', $params['post_id'] ); // change 'name_of_field' to your field name to look up the currency field by $params['post_id']; | |
$params['facet_display_value'] = $params['facet_display_value'] . ' ' . $currency; | |
} | |
return $params; | |
}, 10, 2 ); |
This file contains 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 | |
/** | |
* Pagination - Show numbered pagination for catalog pages | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/loop/pagination.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and |
This file contains 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 | |
/* | |
Plugin Name: Custom Hooks | |
Plugin URI: https://facetwp.com/ | |
Description: A container for custom hooks | |
Version: 1.0 | |
Author: FacetWP, LLC | |
*/ | |
add_filter( 'facetwp_index_row', function( $params, $class ) { |
This file contains 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 | |
/* | |
* Filter the html of each facet and add labels in front | |
*/ | |
function listable_facetwp_facet_html( $html, $params ) { | |
if ( isset( $params['facet'] ) && isset( $params['facet']['label'] ) ) { | |
$html = '<label class="facetwp-filter-title">' . facetwp_i18n( $params['facet']['label'] ) . '</label><div class="facet-wrapper">' . $html . '</div>'; | |
} |
This file contains 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 | |
$args = array( | |
'level' = > array( | |
'key' => '_hmd_practice_membership_level', | |
'value' => array( 'gold', 'silver', 'bronze', 'basic', 'free' ), | |
'compare' => 'IN' | |
) | |
); |
This file contains 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_is_main_query', function( $is_main_query, $query ) { | |
if ( 'event' !== $query->get( 'post_type' ) ) { | |
$is_main_query = false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); |
This file contains 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
<style> | |
.facetwp-facet.facetwp-facet-vehicle_type { | |
margin-bottom: 0; | |
} | |
.facetwp-facet-vehicle_type .facetwp-radio { | |
display: inline-block; | |
background: none; | |
line-height: 48px; | |
width: 120px; | |
margin: 0; |
This file contains 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 | |
/** reindex after adding filter code */ | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'label_fr' == $params['facet_name'] ) { // change if needed | |
if ( 183 != $params['term_id'] && 183 != $params['parent_id'] ) ) { | |
$params['facet_value'] = ''; | |
} | |
} |