How create specific results url ?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How create specific results url ?

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 5 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9696
    aprivileggio
    aprivileggio
    Participant

    Hello from France !

    I bought and configured perfectly your plugin : http://sandboxapriv.com/catalogue-en-ligne/
    But there is something i need and i don’t know how to do it…

    I want to create url for specifics results, for example i want url where appear only results from “Juillet / Aout” taxonomie.
    Can you help me to do it please ?

    Thanks in advance

    #9697
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thank you for your kind words!

    Well, if I understand correctly you want to assign a custom URL for some of the results. You will need a bit of a custom code for that.

    Solution 1
    I usually suggest using a custom field on the post editor to store a custom URL if it’s different for each result. Then you can use that custom field to replace the results. Knowledge base: Changing results url to a custom field

    Solution 2
    If the URL is static for each result, or if you want to manipulate it, then this code would be the best to start with in your case. Use this in the functions.php file in your active theme directory:

    
    add_filter( 'asp_results', 'asp_change_url_on_terms', 1, 1 );
      
    function asp_change_url_on_terms( $results ) {
      $options = $_POST['options'];
      
      if ( isset($options['termset']['periodes']) && $options['termset']['periodes'] == 68 ) {
        foreach ($results as $k=>&$r) {  
          $r->link  = "your custom URL here";
        }
      }
    
      return $results;
    }
    

    I’ve customized this code so, In this case the foreach statement is only executed when the “Juillet/Aout” taxonomy term is selected. Change the $r->link variable to the URL you wanted.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.