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

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Random sorting with seed #44924
    kevinkkevink
    Participant

    It worked, thank you!
    I put this hook in my theme’s custom_functions.php

    function asp_modify_query_string($query, $args, $search_id, $is_ajax) {
    	$seed = date("z") + 1;
    	$query = str_replace("RAND()", "RAND($seed)", $query);
    	return $query;
    }
    add_filter("asp_query_cpt", "asp_modify_query_string", 10, 4);

    Then edited

    case "RAND()":
      $diff = rand(-1,1);
      break;

    to be

    case "RAND()":
      $diff = 0;
      break;

    in includes/classes/Search/SearchPostTypes.php

    then set post ordering to random in Ajax Search Pro.

    Now the random results have no duplicates when paginating.

    in reply to: Random sorting with seed #44893
    kevinkkevink
    Participant

    You cannot access this content.

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