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

How create specific results url ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9696
    aprivileggioaprivileggio
    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 MarcinkoErnest 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:

    [php]
    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;
    }
    [/php]

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.