Turn page background into hooked action

This commit is contained in:
Tetrakern 2024-06-13 23:29:48 +02:00
parent 60d8bdd97e
commit 406d33a629
32 changed files with 36 additions and 57 deletions

View File

@ -22,8 +22,6 @@ get_header( null, array( 'no_index' => 1 ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -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 sites `<main>` container, right after the `.main-observer` element.
**Hooked Actions:**
* `fictioneer_page_background()` Renders the page background. Priority 10.
---
### `do_action( 'fictioneer_main_wrapper' )`

View File

@ -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.

View File

@ -97,8 +97,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -20,8 +20,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -97,8 +97,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -57,8 +57,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -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 = '<div class="main__background polygon polygon--main background-texture"></div>';
echo apply_filters( 'fictioneer_filter_page_background', $background );
}
add_action( 'fictioneer_main', 'fictioneer_page_background' );

View File

@ -23,8 +23,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper"><?php
do_action( 'fictioneer_main_wrapper' );
get_template_part( 'partials/_loop' );

View File

@ -57,8 +57,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -68,10 +68,13 @@ get_header();
?>
<main id="main" class="main search-results">
<div class="observer main-observer"></div>
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>
<article id="search-results" class="search-results__article padding-left padding-right padding-top padding-bottom">

View File

@ -26,8 +26,6 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -25,8 +25,6 @@ get_header( null, array( 'type' => 'fcn_recommendation' ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -33,8 +33,6 @@ get_header(
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper _no-padding-top">
<?php

View File

@ -22,8 +22,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -30,8 +30,6 @@ get_header( null, array( 'no_index' => 1 ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -74,8 +74,6 @@ get_header( null, array( 'no_index' => 1 ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -90,8 +90,6 @@ get_header( null, array( 'no_index' => 1 ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -22,8 +22,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -82,8 +82,6 @@ reset( $sorted_stories );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -78,8 +78,6 @@ reset( $sorted_stories );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -30,8 +30,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper <?php echo $render_story_header ? '_no-padding-top' : ''; ?>">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -63,8 +63,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -23,8 +23,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -23,8 +23,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -104,8 +104,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -21,8 +21,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -20,8 +20,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -20,8 +20,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -20,8 +20,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -20,8 +20,6 @@ get_header();
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>

View File

@ -66,8 +66,6 @@ get_header( null, array( 'type' => 'user-profile', 'no_index' => 1 ) );
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>