Skip to content

Instantly share code, notes, and snippets.

@jacquesletesson
Created March 20, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacquesletesson/c50fdd9338aa58e995a2 to your computer and use it in GitHub Desktop.
Save jacquesletesson/c50fdd9338aa58e995a2 to your computer and use it in GitHub Desktop.
Tweak Ajax Search Pro
function filter_asp_results($results){
$new_results = array();
foreach($results as $result){
if($result->post_type == 'artists'){
$id = $result->id;
$tax = wc_attribute_taxonomy_name("artist");
$x = get_term_by('name', $id, $tax);
$result->link = get_permalink( woocommerce_get_page_id( 'shop' ) ) . "?filter_artist=" . $x->term_id;
$new_results[] = $result;
} else {
$new_results[] = $result;
}
}
return $new_results;
}
add_filter('asp_results','filter_asp_results');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment