Forums Forums Search & Filter Pro How to add a string to end of every Search Results URL

Viewing 10 posts - 1 through 10 (of 19 total)
  • Anonymous
    #209383

    Hi, I need to add “#promo” string to an end of every Search Results URL generated with Search & Filter PRO, because I use filtering in a TAB. I need to have search results bookmarkable (no ajax necessary).

    Any idea? jQuery? Or php?

    Anonymous
    #209384

    I am using filtering also on second subpage, where I don’t want to add string to an end of URL. So it needs to be only on one filter ID.

    Anonymous
    #209387

    Or the easiest way will be to add the last filter always selected with value “#promo” and hide it with CSS, but S&F change “#” to “%23”

    Trevor
    #209397

    You would need to use WordPress rewrites (in the child theme functions.php file) I think.

    If they are anchor points, then they need to be before our query string I think. I cannot find any snippets on our forum that would suit though, sorry.

    Anonymous
    #209399

    Ok, so maybe in different way. How to add “#promo” string to an end of every Search Results URL?

    Or where is the file responsible for this? Generated url through decodeURIComponent function will solve this, but I cannot find the place where URL is generated.

    Anonymous
    #209409

    Ok, I can modify url, but it adds value before generated parameters, it should be after.

    Trevor
    #209413

    It doesn’t work when before the parameters?

    Anonymous
    #209417

    I have this:

    function change_sf_results_url( $url,  $sfid) {
    
        //if search form ID = 225, the do something with this query
    	if($sfid==922)
    	{
            $url = add_query_arg('tab', '#promo', $url);
            return $url;
    	}
    }
    add_filter( 'sf_results_url', 'change_sf_results_url', 10, 2 );

    Now url looks like:

    https://xxx.xxx/place/?tab=#promo&_sfm_choice=red

    It should be:

    https://xxx.xxx/place/?_sfm_choice=red&tab=#promo

    Is it possible?

    Trevor
    #209421

    I would have done this:

    function change_sf_results_url( $url,  $sfid) {
    
        //if search form ID = 225, the do something with this query
    	if($sfid==922)
    	{
            $url = add_query_arg($url, 'tab', '#promo');
            return $url;
    	}
    }
    add_filter( 'sf_results_url', 'change_sf_results_url', 10, 2 );
Viewing 10 posts - 1 through 10 (of 19 total)