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 the below code to your child themes functions.php file. | |
// Read the comments below on what to change | |
function fwps_modify_selectable_values( $args ) { | |
// change my_facet with the facet you want to alter | |
if ( 'my_facet' == $args['facet']['name'] ) { | |
// add and remove the slugs of the items you want to exclude | |
$exclude = array( |
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 the code below to your child themes functions.php file | |
add_filter( 'gettext', function( $translated_text, $text, $domain ) { | |
if ( 'fwp' == $domain ) { | |
if ( 'Search' == $translated_text ) { | |
$translated_text = 'The new placeholder'; // Add your placeholder here | |
} | |
} |
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 | |
// create a new FacetWP template called 'Products' | |
// Then place all this code in the "Query Arguments" | |
// Leave "Display Code" empty | |
// in your single product template use the shortcode [facetwp template="product" map="true"] | |
if( !empty( $_POST['data']['http_params']['uri'] ) ){ | |
$product_id = url_to_postid( $_POST['data']['http_params']['uri'] ); | |
}else{ | |
$product_id = get_queried_object_id(); |
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 the code below to your functions.php file of your child theme. | |
// This removes all users that are administrators from being synced in DB Post Types | |
// Uses the `dbpt_source_exclude-{$slug}` filter | |
add_filter( 'dbpt_source_exclude-users', function () { | |
// return the ID's of users NOT to be synced. | |
return get_users( array( | |
'role__in' => array( 'administrator' ), |
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 this to your child themes functions.php file | |
add_filter( 'facetwp_map_init_args', function ( $args ) { | |
$args['scrollwheel'] = false; | |
return $args; | |
} ); |
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 | |
/** | |
* The template for displaying product content in the single-product.php template | |
* | |
* Override this template by copying it to yourtheme/woocommerce/content-single-product.php | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ |
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
function cspm_display_single_product_map(){ | |
echo do_shortcode('[facetwp map="true"]'); | |
} | |
add_action('woocommerce_after_single_product_summary', 'cspm_display_single_product_map', 15); |
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
(function($) { | |
$(document).on('facetwp-refresh', function() { | |
if( FWP.extras['sort'] !== 'default' ){ | |
return; | |
} | |
if ( FWP.facets['baby_sitter_cost'].length ) { | |
FWP.extras['sort'] = 'cost'; | |
}else if ( FWP.facets['age'].length ) { | |
FWP.extras['sort'] = 'age'; | |
}else if ( FWP.facets['experience'].length ) { |
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
function my_facetwp_index_row( $params, $class ) { | |
if ( 'branch' == $params['facet_name'] ) { | |
$values = (array) $params['facet_value']; // an array of post IDs (it's already unserialized) | |
foreach ( $values as $val ) { | |
$params['facet_value'] = the_field( 'martygeocoderlatlng', $val ); | |
$params['facet_display_value'] = the_field('martygeocoderaddress', $val); | |
$class->insert( $params ); // insert each value to the database | |
} | |
// skip the default indexing query | |
return false; |
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
function my_facetwp_facet_html( $output, $params ) { | |
if ( 'monthly_tags' == $params['facet']['name'] ) { | |
$output = ' | |
<div class="facetwp-checkbox" data-value="january-2017"> | |
January 2017 | |
<span class="facetwp-counter">(1)</span> | |
</div> | |
<div class="facetwp-checkbox" data-value="february-2017"> | |
February 2017 | |
<span class="facetwp-counter">(1)</span> |