Random Display Order Update Frequency

This topic contains 1 reply, has 2 voices, and was last updated by  Alex Rollin 4 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #506869

    Wesley Lewis
    Full Member
    Post count: 38

    I’m trying to make the random order update faster than every 24hrs. I’ve found the documentation here:https://wpgeodirectory.com/docs-v2/places/sorting/

    But where should I put the code? in my functions.php? or someplace else?

    Also, what value am I changing in the code below to get it to update every hour?

    Code:
    add_filter(‘geodir_rand_seed’,’_my_geodir_rand_seed’);
    function _my_geodir_rand_seed($rand_seed){
    $rand_seed = get_transient( ‘geodir_rand_seed_custom’ );

    // if we don’t have a transient then set a new one
    if(!$rand_seed){
    $rand_seed = time();
    set_transient( ‘geodir_rand_seed_custom’, $rand_seed, 4 * HOUR_IN_SECONDS );
    }

    // validate
    $rand_seed = absint($rand_seed);

    return $rand_seed;
    }

    #506891

    Alex Rollin
    Moderator
    Post count: 27815

    Use the code snippets plugin
    https://wpgeodirectory.com/docs-v2/faq/customizing/#custom-code

    Change the 4 to the number of hours between reshuffles.

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket