Skip to content

Instantly share code, notes, and snippets.

@barrykooij
Created January 6, 2017 23:32
Show Gist options
  • Save barrykooij/3ed8ba4a8797cf97d0de1dc5e5f72e19 to your computer and use it in GitHub Desktop.
Save barrykooij/3ed8ba4a8797cf97d0de1dc5e5f72e19 to your computer and use it in GitHub Desktop.
/**
* Adding custom filter to WP Car Manager
*/
add_action( 'wpcm_listings_vehicle_filters', 'wpcm_custom_template_vehicle_listings_filters_color', 14 );
function wpcm_custom_template_vehicle_listings_filters_color() {
wp_car_manager()->service( 'template_manager' )->get_template_part( 'listings/filters/color' );
}
add_filter( 'wpcm_get_vehicles_filter_color', 'wpcm_custom_filter_color', 10, 3 );
function wpcm_custom_filter_color( $filter, $key, $val ) {
$filter['key'] = 'wpcm_color';
$filter['value'] = sanitize_title( $val );
$filter['type'] = 'CHAR';
return $filter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment