mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-18 17:33:43 +03:00
Pledge List: Change list order hourly (#132)
Using a seed for the RAND function, based on the date & time, will randomize the list every hour, while keeping the order consistent across any pagination. This also removes the increase to posts_per_page, since pagination is functional again. Fixes #70
This commit is contained in:
parent
e9aeb72c9b
commit
3b97459b15
|
@ -436,14 +436,11 @@ function filter_query( $query ) {
|
|||
break;
|
||||
|
||||
default:
|
||||
$query->set( 'orderby', 'rand' );
|
||||
$date = date( 'YmdH' );
|
||||
$query->set( 'orderby', "RAND($date)" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// todo remove this when `rand` pagination fixed
|
||||
// see https://github.com/WordPress/five-for-the-future/issues/70#issuecomment-549066883.
|
||||
$query->set( 'posts_per_page', 100 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue