Reply To: Is it possible to add additional Views templates?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Is it possible to add additional Views templates? Reply To: Is it possible to add additional Views templates?

#10325
luyendao
luyendao
Participant

Hi Ernest,

I feel bad asking for help all the time, but here goes:

I added this into my theme:
add_filter( ‘asp_only_non_keyword_results’, ‘asp_append_more_results’, 1, 2);

function asp_append_more_results( $results, $id) {

switch ($id) {
case 11:

$args = array(
‘s’ => ‘appleton’,
‘_ajax_search’ => true
);
$asp_q = new ASP_Query($args, $id);

var_dump($asp_q);
return array_merge($asp_q->posts, $results);

}
}

11 – the search instance
s – “appleton” a string I know will return a result

If I search for something gibberish like “jkaldkj129390123” that would be considered a non-result and trigger the above hook right?

I’ve tried variations of the search phrase such as an empty string, as well as keywords I know should match but it’s not showing up displaying “No Results” everytime. I cleared the search cache too, but not sure how to debug this.

My final objective is if I query a match or non-match, i can run another query that will find nearby cities, intersect and merge that array with what I have in my DB. Of course that part is outside of the scope of this plugin, but that’s there I need to get to to be able to run that query based on a match or non-match criteria.

I’m wondering if it’s better instead of using the ajax handler, I let the plugin override the wordpress ?s search functionality and run the logic in the search results “template”.

What do you think?

Thanks again for all your help – i bought another license for our production environment 🙂