Remove order param from date query helper
Completely unnecessary here.
This commit is contained in:
parent
d0e30b024a
commit
35bfa7b058
@ -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() );
|
||||
|
@ -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() );
|
||||
|
@ -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'] );
|
||||
|
@ -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() );
|
||||
|
@ -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() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user