Add filters
This commit is contained in:
parent
ac3e098790
commit
de211c9d6c
16
FILTERS.md
16
FILTERS.md
@ -410,6 +410,14 @@ Filters the return array of the `fictioneer_get_font_colors()` function, used to
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_font_data', $fonts )`
|
||||
Filters the font array compiled from all valid font folders and Google Fonts links in both the parent and child theme. Note that the `fictioneer_get_font_data()` function reads the file system, which is potentially slow.
|
||||
|
||||
**Parameters:**
|
||||
* $fonts (array) – Array of font data.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_header_image', $header_image_url, $post_id )`
|
||||
Filters the URL of the header image in the `header.php` template.
|
||||
|
||||
@ -605,6 +613,14 @@ Filters the intermediate output array of the `fictioneer_get_post_meta_items()`
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_pre_build_bundled_fonts', $fonts )`
|
||||
Filters the font array before the bundled-fonts.css stylesheet is built in the `fictioneer_build_bundled_fonts()` function. This allows you to add, remove, or change fonts at the last opportunity. Note that the function reads the file system, which is potentially slow. The result is cached in the `fictioneer_chapter_fonts` option.
|
||||
|
||||
**Parameters:**
|
||||
* $fonts (array) – Array of font data.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_recommendations_card_args', $card_args, $args )`
|
||||
Filters the arguments passed to the `partials/_card-recommendation` template part in the `fictioneer_recommendations_list( $args )` function, normally added via the `fictioneer_recommendations_after_content` hook.
|
||||
|
||||
|
@ -2923,6 +2923,9 @@ function fictioneer_get_font_data() {
|
||||
// Merge finds
|
||||
$fonts = array_merge( $parent_fonts, $child_fonts, $google_fonts );
|
||||
|
||||
// Apply filters
|
||||
$fonts = apply_filters( 'fictioneer_filter_font_data', $fonts );
|
||||
|
||||
// Return complete font list
|
||||
return $fonts;
|
||||
}
|
||||
@ -2944,6 +2947,9 @@ function fictioneer_build_bundled_fonts() {
|
||||
$combined_font_css = '';
|
||||
$font_stack = [];
|
||||
|
||||
// Apply filters
|
||||
$fonts = apply_filters( 'fictioneer_filter_pre_build_bundled_fonts', $fonts );
|
||||
|
||||
// Make sure directory exists
|
||||
if ( ! file_exists( dirname( $bundled_fonts ) ) ) {
|
||||
mkdir( dirname( $bundled_fonts ), 0755, true );
|
||||
|
Loading…
x
Reference in New Issue
Block a user