Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active April 19, 2018 22:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/78158bcdd7510dc1a949c3af819eef03 to your computer and use it in GitHub Desktop.
Save mgibbs189/78158bcdd7510dc1a949c3af819eef03 to your computer and use it in GitHub Desktop.
facetwp_index_row
<?php
// Set the facet's Data source to "Post Type" as a placeholder
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'is_beer_on_tap' == $params['facet_name'] ) {
if ( is_beer_available( $params['post_id'] ) ) {
$params['facet_value'] = 'on-tap';
$params['facet_display_value'] = 'On tap';
}
return false; // don't index anything else
}
return $params;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment