From 406d33a629558af0e796a88a65b38750f071abf6 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Thu, 13 Jun 2024 23:29:48 +0200 Subject: [PATCH] Turn page background into hooked action --- 404.php | 2 -- ACTIONS.md | 3 +++ FILTERS.md | 8 ++++++++ author.php | 2 -- category.php | 2 -- chapters.php | 2 -- collections.php | 2 -- includes/functions/_helpers-templates.php | 21 +++++++++++++++++++++ index.php | 2 -- recommendations.php | 2 -- search.php | 5 ++++- single-fcn_collection.php | 2 -- single-fcn_recommendation.php | 2 -- single-fcn_story.php | 2 -- single-post.php | 2 -- singular-bookmarks.php | 2 -- singular-bookshelf-ajax.php | 2 -- singular-bookshelf.php | 2 -- singular-canvas-page.php | 2 -- singular-index-advanced.php | 2 -- singular-index.php | 2 -- singular-story.php | 2 -- singular-taxonomies.php | 2 -- singular-titleless.php | 2 -- singular.php | 2 -- stories.php | 2 -- tag.php | 2 -- taxonomy-fcn_character.php | 2 -- taxonomy-fcn_content_warning.php | 2 -- taxonomy-fcn_fandom.php | 2 -- taxonomy-fcn_genre.php | 2 -- user-profile.php | 2 -- 32 files changed, 36 insertions(+), 57 deletions(-) diff --git a/404.php b/404.php index 1e656833..970c2d2d 100644 --- a/404.php +++ b/404.php @@ -22,8 +22,6 @@ get_header( null, array( 'no_index' => 1 ) ); -
-
diff --git a/ACTIONS.md b/ACTIONS.md index 54b4f688..88421941 100644 --- a/ACTIONS.md +++ b/ACTIONS.md @@ -676,6 +676,9 @@ Fires before the content of the card grid is rendered in the `partials/_card-sto ### `do_action( 'fictioneer_main' )` Fires after opening the site’s `
` container, right after the `.main-observer` element. +**Hooked Actions:** +* `fictioneer_page_background()` – Renders the page background. Priority 10. + --- ### `do_action( 'fictioneer_main_wrapper' )` diff --git a/FILTERS.md b/FILTERS.md index fe95bd3c..ab125098 100644 --- a/FILTERS.md +++ b/FILTERS.md @@ -726,6 +726,14 @@ Filters the obfuscation string generated for chapter spoilers and protected post --- +### `apply_filters( 'fictioneer_filter_page_background', $html )` +Filters the HTML of the page background element, which is absolute positioned under the actual content. + +**Parameters:** +* $html (string) – The HTML element of the page background. + +--- + ### `apply_filters( 'fictioneer_filter_page_card_footer', $footer_items, $post, $args )` Filters the intermediate output array in the `_card-page.php` partial before it is imploded and rendered. Contains statistics with icons such as the author, publishing date, and comments. diff --git a/author.php b/author.php index aa7c46f8..e505b059 100644 --- a/author.php +++ b/author.php @@ -97,8 +97,6 @@ get_header(); -
-
diff --git a/category.php b/category.php index 3d3269ab..ae9ceb6e 100644 --- a/category.php +++ b/category.php @@ -20,8 +20,6 @@ get_header(); -
-
diff --git a/chapters.php b/chapters.php index 8ef786b0..e05bdb53 100644 --- a/chapters.php +++ b/chapters.php @@ -97,8 +97,6 @@ get_header(); -
-
diff --git a/collections.php b/collections.php index af8c75ac..96bc5a87 100644 --- a/collections.php +++ b/collections.php @@ -57,8 +57,6 @@ get_header(); -
-
diff --git a/includes/functions/_helpers-templates.php b/includes/functions/_helpers-templates.php index 1d21975a..e6d6be82 100644 --- a/includes/functions/_helpers-templates.php +++ b/includes/functions/_helpers-templates.php @@ -2043,3 +2043,24 @@ function fictioneer_get_story_changelog( $story_id ) { // Return return $changelog; } + +// ============================================================================= +// PAGE BACKGROUND +// ============================================================================= + +/** + * Render the page background element + * + * Note: The page background is a separate element, absolute positioned under the + * actual content. This allows for quite some CSS shenanigans and can improve the + * render performance in certain scenarios. Hooked to 'fictioneer_main' action. + * + * @since 5.20.0 + */ + +function fictioneer_page_background() { + $background = '
'; + + echo apply_filters( 'fictioneer_filter_page_background', $background ); +} +add_action( 'fictioneer_main', 'fictioneer_page_background' ); diff --git a/index.php b/index.php index 13ec2572..d616c4be 100644 --- a/index.php +++ b/index.php @@ -23,8 +23,6 @@ get_header(); -
-
-
-
diff --git a/search.php b/search.php index 35543751..2d3ed17b 100644 --- a/search.php +++ b/search.php @@ -68,10 +68,13 @@ get_header(); ?>
+
+ -
+
+
diff --git a/single-fcn_collection.php b/single-fcn_collection.php index 9a0c3ec1..6042d4e7 100644 --- a/single-fcn_collection.php +++ b/single-fcn_collection.php @@ -26,8 +26,6 @@ get_header( null, array( 'type' => 'fcn_collection' ) ); -
-
diff --git a/single-fcn_recommendation.php b/single-fcn_recommendation.php index 610ff8f9..2f92823e 100644 --- a/single-fcn_recommendation.php +++ b/single-fcn_recommendation.php @@ -25,8 +25,6 @@ get_header( null, array( 'type' => 'fcn_recommendation' ) ); -
-
diff --git a/single-fcn_story.php b/single-fcn_story.php index ed02e86b..8150bd67 100644 --- a/single-fcn_story.php +++ b/single-fcn_story.php @@ -33,8 +33,6 @@ get_header( -
-
-
-
diff --git a/singular-bookmarks.php b/singular-bookmarks.php index 79155659..e46d1a00 100644 --- a/singular-bookmarks.php +++ b/singular-bookmarks.php @@ -30,8 +30,6 @@ get_header( null, array( 'no_index' => 1 ) ); -
-
diff --git a/singular-bookshelf-ajax.php b/singular-bookshelf-ajax.php index f6b9a767..43a0c1af 100644 --- a/singular-bookshelf-ajax.php +++ b/singular-bookshelf-ajax.php @@ -74,8 +74,6 @@ get_header( null, array( 'no_index' => 1 ) ); -
-
diff --git a/singular-bookshelf.php b/singular-bookshelf.php index 02abea53..500d6de9 100644 --- a/singular-bookshelf.php +++ b/singular-bookshelf.php @@ -90,8 +90,6 @@ get_header( null, array( 'no_index' => 1 ) ); -
-
diff --git a/singular-canvas-page.php b/singular-canvas-page.php index 1b4979da..17d41627 100644 --- a/singular-canvas-page.php +++ b/singular-canvas-page.php @@ -22,8 +22,6 @@ get_header(); -
-
diff --git a/singular-index-advanced.php b/singular-index-advanced.php index ba2f3c33..66ce1ac8 100644 --- a/singular-index-advanced.php +++ b/singular-index-advanced.php @@ -82,8 +82,6 @@ reset( $sorted_stories ); -
-
diff --git a/singular-index.php b/singular-index.php index 6f181a8f..43061e47 100644 --- a/singular-index.php +++ b/singular-index.php @@ -78,8 +78,6 @@ reset( $sorted_stories ); -
-
diff --git a/singular-story.php b/singular-story.php index 8521f706..0ded70ea 100644 --- a/singular-story.php +++ b/singular-story.php @@ -30,8 +30,6 @@ get_header(); -
-
diff --git a/singular-taxonomies.php b/singular-taxonomies.php index df65dc18..5bfb7b27 100644 --- a/singular-taxonomies.php +++ b/singular-taxonomies.php @@ -63,8 +63,6 @@ get_header(); -
-
diff --git a/singular-titleless.php b/singular-titleless.php index ad1fa132..305da52b 100644 --- a/singular-titleless.php +++ b/singular-titleless.php @@ -23,8 +23,6 @@ get_header(); -
-
diff --git a/singular.php b/singular.php index 81e41c31..aef1bbcc 100644 --- a/singular.php +++ b/singular.php @@ -23,8 +23,6 @@ get_header(); -
-
diff --git a/stories.php b/stories.php index f7533e51..93d07355 100644 --- a/stories.php +++ b/stories.php @@ -104,8 +104,6 @@ get_header(); -
-
diff --git a/tag.php b/tag.php index 5d90a55d..4916b4f1 100644 --- a/tag.php +++ b/tag.php @@ -21,8 +21,6 @@ get_header(); -
-
diff --git a/taxonomy-fcn_character.php b/taxonomy-fcn_character.php index 491c0e60..9e1348bd 100644 --- a/taxonomy-fcn_character.php +++ b/taxonomy-fcn_character.php @@ -20,8 +20,6 @@ get_header(); -
-
diff --git a/taxonomy-fcn_content_warning.php b/taxonomy-fcn_content_warning.php index 376afaae..a9008f28 100644 --- a/taxonomy-fcn_content_warning.php +++ b/taxonomy-fcn_content_warning.php @@ -20,8 +20,6 @@ get_header(); -
-
diff --git a/taxonomy-fcn_fandom.php b/taxonomy-fcn_fandom.php index 0b52f0a8..92d34700 100644 --- a/taxonomy-fcn_fandom.php +++ b/taxonomy-fcn_fandom.php @@ -20,8 +20,6 @@ get_header(); -
-
diff --git a/taxonomy-fcn_genre.php b/taxonomy-fcn_genre.php index 723fe1f9..d7c43b95 100644 --- a/taxonomy-fcn_genre.php +++ b/taxonomy-fcn_genre.php @@ -20,8 +20,6 @@ get_header(); -
-
diff --git a/user-profile.php b/user-profile.php index 9db9ba49..bf90becb 100644 --- a/user-profile.php +++ b/user-profile.php @@ -66,8 +66,6 @@ get_header( null, array( 'type' => 'user-profile', 'no_index' => 1 ) ); -
-