From d15d4c6e1dd0115052cfdb0434a8463b02469bfa Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Fri, 14 Jun 2024 01:23:49 +0200 Subject: [PATCH] Move main observer element to action hook --- 404.php | 2 -- ACTIONS.md | 5 +++-- author.php | 2 -- category.php | 2 -- chapters.php | 2 -- collections.php | 2 -- includes/functions/_helpers-templates.php | 15 ++++++++++++++- index.php | 2 -- recommendations.php | 2 -- search.php | 2 -- single-fcn_chapter.php | 2 -- 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-main.php | 2 -- singular-canvas-page.php | 2 -- singular-canvas-site.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 -- 34 files changed, 17 insertions(+), 67 deletions(-) diff --git a/404.php b/404.php index 8027d885..6bb0154f 100644 --- a/404.php +++ b/404.php @@ -18,8 +18,6 @@ get_header( null, array( 'no_index' => 1 ) );
-
-
diff --git a/ACTIONS.md b/ACTIONS.md index 702f6de2..a70c65f9 100644 --- a/ACTIONS.md +++ b/ACTIONS.md @@ -674,12 +674,13 @@ Fires before the content of the card grid is rendered in the `partials/_card-sto --- ### `do_action( 'fictioneer_main', $context )` -Fires after opening the site’s `
` container, right after the `.main-observer` element. +Fires after opening the site’s `
` container. **Parameters:** -* $context (string|null) – Context of the action call. Unsafe. +* $context (string|null) – Context of the action call, typically related to the template. Unsafe. **Hooked Actions:** +* `fictioneer_main_observer()` – Renders the main observer element. Priority 1. * `fictioneer_page_background()` – Renders the page background. Priority 10. --- diff --git a/author.php b/author.php index f29df261..6d0fa6ca 100644 --- a/author.php +++ b/author.php @@ -93,8 +93,6 @@ get_header();
-
-
diff --git a/category.php b/category.php index 19d4806b..f6ad4fb4 100644 --- a/category.php +++ b/category.php @@ -16,8 +16,6 @@ get_header();
-
-
diff --git a/chapters.php b/chapters.php index a6caba17..ad2bd68d 100644 --- a/chapters.php +++ b/chapters.php @@ -93,8 +93,6 @@ get_header();
-
-
diff --git a/collections.php b/collections.php index 5ae62ab8..05ed9664 100644 --- a/collections.php +++ b/collections.php @@ -53,8 +53,6 @@ get_header();
-
-
diff --git a/includes/functions/_helpers-templates.php b/includes/functions/_helpers-templates.php index e936a7d5..6f1ef1bd 100644 --- a/includes/functions/_helpers-templates.php +++ b/includes/functions/_helpers-templates.php @@ -2049,7 +2049,20 @@ function fictioneer_get_story_changelog( $story_id ) { // ============================================================================= /** - * Render the page background element + * Renders the main observer element + * + * @since 5.20.0 + * + * @param string|null $context Optional. Context of the function call. + */ + +function fictioneer_main_observer( $context = null ) { + echo '
'; +} +add_action( 'fictioneer_main', 'fictioneer_main_observer', 1 ); + +/** + * Renders 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 diff --git a/index.php b/index.php index d616c4be..5209270c 100644 --- a/index.php +++ b/index.php @@ -19,8 +19,6 @@ get_header();
-
-
-
-
diff --git a/search.php b/search.php index d18eb20c..15b40126 100644 --- a/search.php +++ b/search.php @@ -69,8 +69,6 @@ get_header();
-
-
diff --git a/single-fcn_chapter.php b/single-fcn_chapter.php index 257e9705..052de1fb 100644 --- a/single-fcn_chapter.php +++ b/single-fcn_chapter.php @@ -32,8 +32,6 @@ get_header(
-
-
diff --git a/single-fcn_collection.php b/single-fcn_collection.php index 9631811a..00a95dee 100644 --- a/single-fcn_collection.php +++ b/single-fcn_collection.php @@ -22,8 +22,6 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
-
-
diff --git a/single-fcn_recommendation.php b/single-fcn_recommendation.php index 80757c97..fba2b8c4 100644 --- a/single-fcn_recommendation.php +++ b/single-fcn_recommendation.php @@ -21,8 +21,6 @@ get_header( null, array( 'type' => 'fcn_recommendation' ) );
-
-
diff --git a/single-fcn_story.php b/single-fcn_story.php index 122cb1b2..24b1d772 100644 --- a/single-fcn_story.php +++ b/single-fcn_story.php @@ -29,8 +29,6 @@ get_header(
-
-
diff --git a/single-post.php b/single-post.php index 165f415d..c1dbca80 100644 --- a/single-post.php +++ b/single-post.php @@ -18,8 +18,6 @@ get_header();
-
-
diff --git a/singular-bookmarks.php b/singular-bookmarks.php index 46140fc0..f6acbfa7 100644 --- a/singular-bookmarks.php +++ b/singular-bookmarks.php @@ -26,8 +26,6 @@ get_header( null, array( 'no_index' => 1 ) );
-
-
diff --git a/singular-bookshelf-ajax.php b/singular-bookshelf-ajax.php index 70fb4365..786efc1e 100644 --- a/singular-bookshelf-ajax.php +++ b/singular-bookshelf-ajax.php @@ -70,8 +70,6 @@ get_header( null, array( 'no_index' => 1 ) );
-
-
diff --git a/singular-bookshelf.php b/singular-bookshelf.php index aceb94c9..717b2397 100644 --- a/singular-bookshelf.php +++ b/singular-bookshelf.php @@ -86,8 +86,6 @@ get_header( null, array( 'no_index' => 1 ) );
-
-
diff --git a/singular-canvas-main.php b/singular-canvas-main.php index 3e177f26..ed9b5f5b 100644 --- a/singular-canvas-main.php +++ b/singular-canvas-main.php @@ -18,8 +18,6 @@ get_header();
-
- -
-
diff --git a/singular-canvas-site.php b/singular-canvas-site.php index 78cee44b..42b80195 100644 --- a/singular-canvas-site.php +++ b/singular-canvas-site.php @@ -18,8 +18,6 @@ get_header( null, array( 'blank' => 1 ) );
-
- -
-
diff --git a/singular-index.php b/singular-index.php index b2b1a29a..3dd019f9 100644 --- a/singular-index.php +++ b/singular-index.php @@ -74,8 +74,6 @@ reset( $sorted_stories );
-
-
diff --git a/singular-story.php b/singular-story.php index 320a37e2..745673f3 100644 --- a/singular-story.php +++ b/singular-story.php @@ -26,8 +26,6 @@ get_header();
-
-
diff --git a/singular-taxonomies.php b/singular-taxonomies.php index 9984aef6..b2014573 100644 --- a/singular-taxonomies.php +++ b/singular-taxonomies.php @@ -59,8 +59,6 @@ get_header();
-
-
diff --git a/singular-titleless.php b/singular-titleless.php index 00e01319..5e63fa9f 100644 --- a/singular-titleless.php +++ b/singular-titleless.php @@ -19,8 +19,6 @@ get_header();
-
-
diff --git a/singular.php b/singular.php index ef89e03c..af3abb82 100644 --- a/singular.php +++ b/singular.php @@ -19,8 +19,6 @@ get_header();
-
-
diff --git a/stories.php b/stories.php index c902c185..5d8ecee6 100644 --- a/stories.php +++ b/stories.php @@ -100,8 +100,6 @@ get_header();
-
-
diff --git a/tag.php b/tag.php index 9f633014..dbad3a4f 100644 --- a/tag.php +++ b/tag.php @@ -17,8 +17,6 @@ get_header();
-
-
diff --git a/taxonomy-fcn_character.php b/taxonomy-fcn_character.php index 4a4e3690..2a9cca11 100644 --- a/taxonomy-fcn_character.php +++ b/taxonomy-fcn_character.php @@ -16,8 +16,6 @@ get_header();
-
-
diff --git a/taxonomy-fcn_content_warning.php b/taxonomy-fcn_content_warning.php index 420d078c..92074dca 100644 --- a/taxonomy-fcn_content_warning.php +++ b/taxonomy-fcn_content_warning.php @@ -16,8 +16,6 @@ get_header();
-
-
diff --git a/taxonomy-fcn_fandom.php b/taxonomy-fcn_fandom.php index 1d0ead46..c7d06183 100644 --- a/taxonomy-fcn_fandom.php +++ b/taxonomy-fcn_fandom.php @@ -16,8 +16,6 @@ get_header();
-
-
diff --git a/taxonomy-fcn_genre.php b/taxonomy-fcn_genre.php index e32c7185..442df073 100644 --- a/taxonomy-fcn_genre.php +++ b/taxonomy-fcn_genre.php @@ -16,8 +16,6 @@ get_header();
-
-
diff --git a/user-profile.php b/user-profile.php index 3cf21765..93699330 100644 --- a/user-profile.php +++ b/user-profile.php @@ -62,8 +62,6 @@ get_header( null, array( 'type' => 'user-profile', 'no_index' => 1 ) );
-
-