This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

search results link like filters

Home Forums Product Support Forums Ajax Search Pro for WordPress Support search results link like filters

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #25988
    dilsecreativodilsecreativo
    Participant

    Hi,
    Did you watch the video?

    • This reply was modified 6 years, 3 months ago by dilsecreativodilsecreativo.
    #25994
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Oh okay, I understand now fully, thanks for the video. It should be pretty simple, I would do it like this:

    add_filter( 'asp_results', 'asp_change_result_uri', 10, 4 );
    function asp_change_result_uri($results, $search_id, $is_ajax, $args) {
    	foreach ( $results as $k => &$r ) {
    		$link_parts = explode('?', $r->link);
    		$r->link = 'http://localhost/oviedoincluye/directorio/?' . $link_parts[1];
    	}
        return $results;
    }
    #25995
    dilsecreativodilsecreativo
    Participant

    🙂 Perfect now it works

    Thank you very very much.

    One more things.
    How I can limit this function or the filter to apply just to that search form or that page.

    I have multiple search form on the site for different things and I want this filter to be applied only on [wd_asp id=6] or the directorio page.

    Thankyou

    #25996
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You are welcome. Using the $search_id variable it is possible as well:

    
    add_filter( 'asp_results', 'asp_change_result_uri', 10, 4 );
    function asp_change_result_uri($results, $search_id, $is_ajax, $args) {
    	if ( $search_id == 6 ) {
    		foreach ( $results as $k => &$r ) {
    			$link_parts = explode('?', $r->link);
    			$r->link = 'http://localhost/oviedoincluye/directorio/?' . $link_parts[1];
    		}
    	}
        return $results;
    }
    #25997
    dilsecreativodilsecreativo
    Participant

    I love you mate 🙂
    Thankyou very very much

    #25998
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    #25999
    dilsecreativodilsecreativo
    Participant

    ok I will rate it with the maximum level of stars.

    Don’t close it please because I am configuring now the filter and I am having some difficulty. I will try by myself a bit more and if I don’t get what I want I will ask to you again

Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.