Remove order param from date query helper

Completely unnecessary here.
This commit is contained in:
Tetrakern 2023-06-11 13:38:08 +02:00
parent d0e30b024a
commit 35bfa7b058
5 changed files with 5 additions and 12 deletions

View File

@ -39,7 +39,7 @@ $query_args = array (
);
// Append date query (if any)
$query_args = fictioneer_append_date_query( $query_args, $ago, $order, $orderby );
$query_args = fictioneer_append_date_query( $query_args, $ago, $orderby );
// Filter query arguments
$query_args = apply_filters( 'fictioneer_filter_chapters_query_args', $query_args, get_the_ID() );

View File

@ -37,7 +37,7 @@ $query_args = array (
);
// Append date query (if any)
$query_args = fictioneer_append_date_query( $query_args, $ago, $order, $orderby );
$query_args = fictioneer_append_date_query( $query_args, $ago, $orderby );
// Filter query arguments
$query_args = apply_filters( 'fictioneer_filter_collections_query_args', $query_args, get_the_ID() );

View File

@ -92,25 +92,18 @@ if ( ! function_exists( 'fictioneer_append_date_query' ) ) {
*
* @param array $query_args Query arguments to modify.
* @param string|int $ago Optional. Time range in days or valid date string. Default null.
* @param string $order Optional. Current order. Default null.
* @param string $orderby Optional. Current orderby. Default null.
*
* @return array Modified query arguments.
*/
function fictioneer_append_date_query( $query_args, $ago = null, $order = null, $orderby = null ) {
function fictioneer_append_date_query( $query_args, $ago = null, $orderby = null ) {
// Ago?
if ( empty( $ago ) ) {
$ago = $_GET['ago'] ?? 0;
$ago = is_numeric( $ago ) ? absint( $ago ) : sanitize_text_field( $ago );
}
// Order?
if ( empty( $order ) ) {
$order = array_intersect( [strtolower( $_GET['order'] ?? 0 )], ['desc', 'asc'] );
$order = reset( $order ) ?: 'desc';
}
// Orderby?
if ( empty( $orderby ) ) {
$orderby = array_intersect( [strtolower( $_GET['orderby'] ?? 0 )], ['modified', 'date', 'title', 'rand'] );

View File

@ -37,7 +37,7 @@ $query_args = array (
);
// Append date query (if any)
$query_args = fictioneer_append_date_query( $query_args, $ago, $order, $orderby );
$query_args = fictioneer_append_date_query( $query_args, $ago, $orderby );
// Filter query arguments
$query_args = apply_filters( 'fictioneer_filter_recommendations_query_args', $query_args, get_the_ID() );

View File

@ -49,7 +49,7 @@ $query_args = array (
);
// Append date query (if any)
$query_args = fictioneer_append_date_query( $query_args, $ago, $order, $orderby );
$query_args = fictioneer_append_date_query( $query_args, $ago, $orderby );
// Filter query arguments
$query_args = apply_filters( 'fictioneer_filter_stories_query_args', $query_args, get_the_ID() );