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_action( 'wp_head', function() { | |
?> | |
<script> | |
(function($) { | |
$(document).on('facetwp-loaded', function() { | |
Flatsome.behaviors['lazy-load-images'].attach(); | |
Flatsome.behaviors['quick-view'].attach(); | |
}); |
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 | |
return array( | |
"post_type" => "park", | |
"post_status" => "publish", | |
"posts_per_page" => 100 | |
); |
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
/* updated 2019-02-22 */ | |
{ | |
"facets": [ | |
{ | |
"name": "test_checkboxes", | |
"label": "Test checkboxes", | |
"type": "checkboxes", | |
"source": "post_type", | |
"parent_term": "", | |
"hierarchical": "no", |
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 | |
// here is the code you need | |
// input: "May 18, 2017 to May 24, 2017" | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'date_range_muli' == $params['facet_name'] ) { | |
$dates = explode( ' to ', $params['facet_value'] ); | |
$params['facet_value'] = date( 'Y-m-d', strtotime( $dates[0] ) ); | |
$params['facet_display_value'] = date( 'Y-m-d', strtotime( $dates[1] ) ); | |
} |
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
<script> | |
/* | |
Code placement: see the "Javascript" section on https://facetwp.com/how-to-use-hooks/ | |
This assumes that your reset button looks like this: | |
<a class="my-reset-btn" onclick="FWP.reset()">RESET</a> | |
*/ | |
(function($) { |
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( | |
'post_type' => 'location', | |
'posts_per_page' => -1, | |
'order' => 'ASC', | |
'orderby' => 'title', | |
'facetwp' => true, | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'advertiser-level', |
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 or updating this filter | |
*/ | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'dates' == $params['facet_name'] ) { | |
$raw_value = $params['facet_value']; | |
$params['facet_display_value'] = date( 'F j, Y', strtotime( $raw_value ) ); // "April 10, 2019" for the display value | |
} |
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 | |
function fwp_load_more() { | |
?> | |
<script> | |
(function($) { | |
$(function() { | |
if ('object' != typeof FWP) { | |
return; | |
} |
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 | |
function change_proximity_label( $translated_text ) { | |
if ( 'Enter location' == $translated_text ) { | |
return 'My new placeholder text'; | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'change_proximity_label' ); |
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 | |
/** | |
* This assumes a "gmaps" folder within your theme | |
* Within that folder, add m1.png, m2.png, m3.png, m4.png, m5.png | |
*/ | |
add_filter( 'facetwp_map_init_args', function( $settings ) { | |
$settings['imagePath'] = get_bloginfo( 'stylesheet_directory' ) . '/gmaps/m'; | |
return $settings; | |
}); |
NewerOlder