Update fcntr() filters and documentation

Also remove some copy/paste garbage.
This commit is contained in:
Tetrakern 2024-05-01 13:08:25 +02:00
parent 5bb7921bc4
commit 39c46ba4a5
3 changed files with 12 additions and 6 deletions

View File

@ -1193,7 +1193,7 @@ Filters the exclusion array of page templates for the custom theme sitemap. By d
---
### `apply_filters( 'fictioneer_filter_sof_date_options', $options, $current_url, $args )`
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'.
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'.
**$options:**
* '0' (array) Tuple of $label (Any Date) and unescaped $url (`...ago=0&...#sof`).
@ -1427,9 +1427,7 @@ Filters the intermediate output array of the `fictioneer_get_subscribe_options(
---
### `apply_filters( 'fictioneer_filter_taxonomy_pills_group', $group, $key, $context )`
Filters the groups passed to `fictioneer_get_taxonomy_pills(...)` before they are looped and rendered, allowing you to limit the number of taxonomies or randomize the order, for example.
Filters the source array of selected translation strings used in the theme, see `fcntr( $key, $escape )` function in `includes/functions/_utility.php`. You cannot translate the whole theme with this, but give it a personal touch.
Filters the groups passed to `fictioneer_get_taxonomy_pills()` before they are looped and rendered, allowing you to limit the number of taxonomies or randomize the order, for example.
**Parameters:**
* $group (array) Array of WP_Term objects.
@ -1439,13 +1437,18 @@ Filters the source array of selected translation strings used in the theme, see
---
### `apply_filters( 'fictioneer_filter_translations', $strings )`
Filters the source array of selected translation strings used in the theme, see `fcntr( $key, $escape )` function in `includes/functions/_utility.php`. You cannot translate the whole theme with this, but give it a personal touch.
Filters the source array of selected translation strings used in the theme, see `fcntr()` function in `includes/functions/_utility.php`. You cannot translate the whole theme with this, but give it a personal touch.
**Parameters:**
* $strings (array) Associative array of translation keys and values.
---
### `apply_filters( 'fictioneer_filter_translations_static', $strings )`
Same as the `fictioneer_filter_translations` filter, but only applied once when the `fcntr()` function is first called and cached in a static variable to save system resources. Using this is recommended if possible.
---
### `apply_filters( 'fictioneer_filter_user_menu_items', $items )`
Filters the intermediate output array of the `fictioneer_user_menu_items()` function before it is imploded and returned. Contains links to the users account, reading lists, and bookmarks as well as the sites Discord, site settings modal toggle, and logout link. Used in the `partials/_icon-menu.php` partial if the user is logged in.

View File

@ -630,7 +630,7 @@ For more details on Patreon, see [Patreon Integration](#patreon-integration) fur
![Phrases Settings Preview](repo/assets/settings_phrases_preview.png?raw=true)
Allows for some minor translations and changes, such as the cookie notice banner or comment reply notification email. More customization can be achieved with the themes [translation filter](FILTERS.md#apply_filters-fictioneer_filter_translations-strings-). But if you want to translate the theme into a new language, you will need to include the proper [translation files](https://developer.wordpress.org/plugins/internationalization/localization/) or use a plugin.
Allows for some minor translations and changes, such as the cookie notice banner or comment reply notification email. More customization can be achieved with the themes [translation filter](FILTERS.md#apply_filters-fictioneer_filter_translations_static-strings-). But if you want to translate the theme into a new language, you will need to include the proper [translation files](https://developer.wordpress.org/plugins/internationalization/localization/) or use a plugin. You can find a .POT template file in the languages folder.
### Fonts Tab

View File

@ -1788,6 +1788,9 @@ function fcntr( $key, $escape = false ) {
'private_prefix' => _x( 'Private:', 'Chapter list status prefix.', 'fictioneer' ),
'free_patreon_tier' => _x( 'Follower (free)', 'Free Patreon tier (follower).', 'fictioneer' )
);
// Filter static translations
$strings = apply_filters( 'fictioneer_filter_translations_static', $strings );
}
// Filter translations