Skip to content

Commit debaebb

Browse files
committed
Add filters to sort-order-filter options
1 parent f003ffe commit debaebb

File tree

2 files changed

+287
-218
lines changed

2 files changed

+287
-218
lines changed

FILTERS.md

+71-18
Original file line numberDiff line numberDiff line change
@@ -416,24 +416,6 @@ Filters the intermediate output array of the `fictioneer_mobile_user_menu()` fun
416416

417417
---
418418

419-
### `apply_filters( 'fictioneer_filter_orderby_popup_menu', $menu, $args )`
420-
Filters the array of URLs and labels of the orderby popup menu in the `fictioneer_sort_order_filter_interface( $args )` function before it is rendered.
421-
422-
**$menu:**
423-
* $modified (array) – Tuple of $label (Updated) and unescaped $url (`...?orderby=modified&order={$order}#sof`).
424-
* $date (array) – Tuple of $label (Published) and unescaped $url (`...?orderby=date&order={$order}#sof`).
425-
* $title (array) – Tuple of $label (Title) and unescaped $url (`...?orderby=title&order={$order}#sof`).
426-
427-
**$args:**
428-
* $current_page (int) – Current page if paginated or `1`.
429-
* $post_id (int) – Current post ID.
430-
* $queried_type (string) – Queried post type.
431-
* $query_args (array) – Query arguments used.
432-
* $order (string) – Current order or `'desc'`.
433-
* $orderby (string) – Current orderby or `'modified'`.
434-
435-
---
436-
437419
### `apply_filters( 'fictioneer_filter_post_meta_items', $output, $args )`
438420
Filters the intermediate output array of the `fictioneer_get_post_meta_items()` function before it is imploded and returned.
439421

@@ -757,6 +739,77 @@ Filters the query arguments in the `fictioneer_showcase` shortcode. The optional
757739

758740
---
759741

742+
### `apply_filters( 'fictioneer_filter_sof_date_options', $options, $current_url, $args )`
743+
Filters the option array of URL/label tuples for the date popup menu in the `fictioneer_sort_order_filter_interface( $args )` function before it is rendered. Can be any positive integer (days) or [strtotime](https://www.php.net/manual/en/function.strtotime.php) compatible string. See `fictioneer_append_date_query(...)`. Includes '0', '1', '3', '1 week ago', '1 month ago', '3 months ago', '6 months ago', and '1 year ago'.
744+
745+
**$options:**
746+
* '0' (array) – Tuple of $label (Any Date) and unescaped $url (`...ago=0&...#sof`).
747+
* '1' (array) – Tuple of $label (Past 24 Hours) and unescaped $url (`...ago=1&...#sof`).
748+
* '3' (array) – Tuple of $label (Past 3 Days) and unescaped $url (`...ago=3&...#sof`).
749+
* '1_week_ago' (array) – Tuple of $label (Past Week) and unescaped $url (`...ago=1+week+ago&...#sof`).
750+
* '1_month_ago' (array) – Tuple of $label (Past Month) and unescaped $url (`...ago=1+month+ago&...#sof`).
751+
* '3_months_ago' (array) – Tuple of $label (Past 3 Months) and unescaped $url (`...ago=3+months+ago&...#sof`).
752+
* '6_months_ago' (array) – Tuple of $label (Past 6 Months) and unescaped $url (`...ago=6+months+ago&...#sof`).
753+
* '1_year_ago' (array) – Tuple of $label (Past Year) and unescaped $url (`...ago=1+year+ago&...#sof`).
754+
755+
**Parameters:**
756+
* $current_url (array) – Current URL with all query parameters to sort, order, and filter included. Used to build option links.
757+
758+
**$args:**
759+
* $current_page (int) – Current page if paginated or `1`.
760+
* $post_id (int) – Current post ID.
761+
* $queried_type (string) – Queried post type.
762+
* $query_args (array) – Query arguments used.
763+
* $order (string) – Current order. Defaults to `'desc'`.
764+
* $orderby (string) – Current orderby. Defaults to `'modified'` in list templates and `'date'` in archives.
765+
766+
---
767+
768+
### `apply_filters( 'fictioneer_filter_sof_orderby_options', $options, $current_url, $args )`
769+
Filters the option array of URL/label tuples for the orderby popup menu in the `fictioneer_sort_order_filter_interface( $args )` function before it is rendered. Allows and includes 'modified', 'date', 'title', and 'rand' (excluded).
770+
771+
**$options:**
772+
* 'modified' (array) – Tuple of $label (Updated) and unescaped $url (`...orderby=modified&...#sof`).
773+
* 'date' (array) – Tuple of $label (Published) and unescaped $url (`...orderby=date&...#sof`).
774+
* 'title' (array) – Tuple of $label (By Title) and unescaped $url (`...orderby=title&...#sof`).
775+
776+
**Parameters:**
777+
* $current_url (array) – Current URL with all query parameters to sort, order, and filter included. Used to build option links.
778+
779+
**$args:**
780+
* $current_page (int) – Current page if paginated or `1`.
781+
* $post_id (int) – Current post ID.
782+
* $queried_type (string) – Queried post type.
783+
* $query_args (array) – Query arguments used.
784+
* $order (string) – Current order. Defaults to `'desc'`.
785+
* $orderby (string) – Current orderby. Defaults to `'modified'` in list templates and `'date'` in archives.
786+
787+
---
788+
789+
### `apply_filters( 'fictioneer_filter_sof_post_type_options', $options, $current_url, $args )`
790+
Filters the option array of URL/label tuples for the post type popup menu in the `fictioneer_sort_order_filter_interface( $args )` function before it is rendered. Only rendered in archives. Includes 'any', 'post, 'fcn_story', 'fcn_chapter', 'fcn_collection', and 'fcn_recommendation'.
791+
792+
**$options:**
793+
* $any (array) – Tuple of $label (All Posts) and unescaped $url (`...post_type=any&...#sof`).
794+
* $post (array) – Tuple of $label (Blog Posts) and unescaped $url (`...post_type=post&...#sof`).
795+
* $fcn_story (array) – Tuple of $label (Stories) and unescaped $url (`...post_type=fcn_story&...#sof`).
796+
* $fcn_chapter (array) – Tuple of $label (Chapters) and unescaped $url (`...post_type=fcn_chapter&...#sof`).
797+
* $fcn_collection (array) – Tuple of $label (Collections) and unescaped $url (`...post_type=fcn_collection&...#sof`).
798+
* $fcn_recommendation (array) – Tuple of $label (Recommendations) and unescaped $url (`...post_type=fcn_recommendation&...#sof`).
799+
800+
**Parameters:**
801+
* $current_url (array) – Current URL with all query parameters to sort, order, and filter included. Used to build option links.
802+
803+
**$args:**
804+
* $current_page (int) – Current page if paginated or `1`.
805+
* $post_id (int) – Current post ID.
806+
* $queried_type (string) – Queried post type.
807+
* $query_args (array) – Query arguments used.
808+
* $order (string) – Current order. Defaults to `'desc'`.
809+
* $orderby (string) – Current orderby. Defaults to `'modified'` in list templates and `'date'` in archives.
810+
811+
---
812+
760813
### `apply_filters( 'fictioneer_filter_stories_card_args', $card_args, $args )`
761814
Filters the arguments passed to the `partials/_card-story` template part in the `fictioneer_stories_list( $args )` function, normally added via the `fictioneer_stories_after_content` hook.
762815

0 commit comments

Comments
 (0)