2 weeks ago
<style>
.gm-style-iw-c,
.gm-style-iw-tc {
display: none;
}
</style>
3 weeks ago
<?php
/**
* add labels above facets by changing shortcode output
* this will apply to all facets except $exclude_types set below
* change or remove conditional to apply this to whichever facets needed
* wrapper can also be added
*/
add_filter( 'facetwp_shortcode_html', function( $output, $atts ) {
if ( isset( $atts["facet"] ) && '' != $atts["facet"] ) { // check for facet shortcode
$exclude_types = [ 'sort', 'reset', 'pager', 'map' ]; // set facet types to exclude from labels
$facet = FWP()->helper->get_facet_by_name( $atts["facet"] ); // get facet settings
if ( !in_array( $facet["type"], $exclude_types ) ) { // conditional to exclude types in $exclude_types
$output = '<h3 class="facet-label">' . $facet["label"] . '</h3>' . $output; // prepend with label and markup
// uncomment below to add facet-wrap
// $output = '<div class="facet-wrap">' . $output . '</div>';
}
}
return $output;
}, 10, 2 );
3 weeks ago
<style>
/** numeric pager facet with some example styles
** to target a specific pager facet, use its facet name
** .facetwp-facet-standard_pager instead of .facetwp-type-pager
** example: .facetwp-type-standard_pager .facetwp-page
** if your css is not being applied, check for adding specificity
** https://www.w3schools.com/css/css_specificity.asp
** or !important https://www.w3schools.com/css/css_important.asp
**/
/** wrapper for pager **/
.facetwp-type-pager .facetwp-pager {
border: 1px solid red;
padding: 5px;
}
/** individual page numbers and text **/
.facetwp-type-pager .facetwp-page {
color: green;
}
/** hover class for page links **/
.facetwp-type-pager .facetwp-page:hover {
text-decoration: underline;
}
/** currently selected link **/
.facetwp-type-pager .facetwp-page.active {
font-style: bold;
}
/** page 1 **/
.facetwp-type-pager .facetwp-page.first {
font-style: italic;
}
/** last page **/
.facetwp-type-pager .facetwp-page.last {
font-style: italic;
}
/** previous page text **/
.facetwp-type-pager .facetwp-page.prev {
color: red;
}
/** next page text **/
.facetwp-type-pager .facetwp-page.next {
color: red;
}
</style>
3 weeks ago
<style>
/** load more button with background-image examples
** to target a specific button, use its facet name
** .facetwp-facet-my_load_more .facetwp-load-more
** .facetwp-facet-my_load_more.facetwp-facet-load_more_pager button
** if your css is not being applied, check for adding specificity
** https://www.w3schools.com/css/css_specificity.asp
** or !important https://www.w3schools.com/css/css_important.asp
**/
.facetwp-load-more {
background-color: yellow;
}
.facetwp-facet-load_more_pager button {
/* same as .facetwp-load-more */
}
.facetwp-load-more:hover {
background-color: green;
}
.facetwp-load-more:active {
background-color: purple;
}
.facetwp-load-more:focus {
background-color: orange;
}
.facetwp-load-more:visited {
/* does not work */
}
.facetwp-facet-load_more_pager.is-loading button {
/** similar to active/focus **/
}
</style>
4 weeks ago
<?php
add_filter( 'facetwp_render_output', function( $output, $params ) {
if ( FWP()->ajax->is_preload && isset( $output['settings']['map']['locations'] ) ) {
$output['settings']['map']['locations'] = [];
}
return $output;
}, 11, 2 );
4 weeks ago
<?php
add_action( 'facetwp_scripts', function() { ?>
<script>
document.addEventListener('facetwp-refresh', function() {
let facet_name = 'categories'; // change 'categories' to name of facet change that resets other facets
if ( null !== FWP.active_facet && facet_name == fUtil(FWP.active_facet.nodes[0]).attr('data-name' ) ) {
let others = FWP.facets;
Object.keys(others).forEach(function (key) {
if ( facet_name != key ) {
FWP.facets[key] = [];
}
});
}
});
</script>
<?php }, 100 );
4 weeks ago
<?php
// A facet with its data source set to "Post Author" will display the author names as choices.
// To display the author nicknames instead, add the following code to your (child) theme's functions.php and re-index.
// For other author meta info you can get with get_the_author_meta() and index/display instead of nicknames, see:
// https://developer.wordpress.org/reference/functions/get_the_author_meta/
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'post_author' == $params['facet_name'] ) { // replace 'post_author' with the name of your facet
$user_id = $params['facet_value'];
$nickname = get_the_author_meta( 'nickname', $user_id );
if ( isset( $nickname ) ) {
$params['facet_display_value'] = $nickname;
}
}
return $params;
}, 10, 2 );
1 month ago
<?php
add_action( 'facetwp_scripts', function() {
?>
<script>
(function($) {
document.addEventListener('facetwp-loaded', function() {
$('.facetwp-facet').each(function() {
var facet = $(this);
var facet_name = facet.attr('data-name');
var facet_type = facet.attr('data-type');
var facet_label = FWP.settings.labels[facet_name];
if (facet_type !== 'pager' && facet_type !== 'sort' && facet_type !== 'reset') {
if (facet.closest('.facet-wrap').len() < 1 && facet.closest('.facetwp-flyout').len() < 1) {
facet.prepend('<h3 class="facet-label">' + facet_label + '</h3>');
}
}
});
});
})(fUtil);
</script>
<?php
}, 100 );
1 month ago
<?php
add_action( 'facetwp_scripts', function() {
?>
<script>
document.addEventListener('facetwp-loaded', function() {
if ( FWP.loaded ) {
jQuery(".facetwp-template").fitVids();
}
});
</script>
<?php
}, 100 );
1 month ago
<?php
add_action( 'facetwp_scripts', function() {
?>
<script>
document.addEventListener('facetwp-loaded', function() {
if ( FWP.loaded ) {
bricksWooAjaxAddToCartFn.run();
}
});
</script>
<?php
}, 100 );