Created
March 20, 2015 08:49
-
-
Save jacquesletesson/c50fdd9338aa58e995a2 to your computer and use it in GitHub Desktop.
Tweak Ajax Search Pro
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
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