Add page wrapper to wp-signup

This commit is contained in:
Tetrakern 2024-05-16 14:27:37 +02:00
parent 89ae5fd6ba
commit de863a6504
5 changed files with 72 additions and 1 deletions

View File

@ -106,6 +106,9 @@ Fires between the sites `<main>` and `<footer>` blocks. This is the empty spa
* $post_id (int|null) Current post ID. Unsafe.
* $breadcrumbs (array) Array of breadcrumb tuples with label (0) and link (1).
**Hooked Actions:**
* `fictioneer_wp_signup_end( $args )` End of the wrapper HTML for the wp-signup page. Priority 999.
---
### `do_action( 'fictioneer_after_oauth_user', $user, $args )`
@ -591,6 +594,7 @@ Fires outside the `#site` container and before the `wp_footer` hook, near the en
**Hooked Actions:**
* `fictioneer_output_modals( $args )` Render modals based on login status and page type. Priority 10.
* `fictioneer_wp_signup_start( $args )` Start of the wrapper HTML for the wp-signup page. Priority 999.
---

View File

@ -26,6 +26,11 @@
$page_id = get_queried_object_id();
$extra_classes = [];
// Catch calls without arguments
$args['post_id'] = $args['post_id'] ?? $page_id;
$args['post_type'] = $args['post_type'] ?? 'none';
$args['breadcrumbs'] = $args['breadcrumbs'] ?? [];
// Fix wrong post ID
if ( $page_id != $args['post_id'] ) {
$args['post_id'] = $page_id;

View File

@ -44,6 +44,14 @@ if ( ! defined( 'CHILD_NAME' ) ) {
define( 'CHILD_NAME', null );
}
/*
* Locations
*/
if ( ! defined( 'FICTIONEER_IS_WP_SIGNUP' ) ) {
define( 'FICTIONEER_IS_WP_SIGNUP', strpos( $_SERVER['REQUEST_URI'], 'wp-signup.php' ) !== false );
}
/*
* Endpoints
*/

View File

@ -52,7 +52,7 @@ if ( is_archive() || is_search() || is_404() ) {
fictioneer_output_head_meta();
// Prevent indexing if required
if ( $args['no_index'] ?? 0 ) {
if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_IS_WP_SIGNUP ) {
add_filter( 'wp_robots', 'fictioneer_add_noindex_to_robots' );
}

View File

@ -871,3 +871,57 @@ function fictioneer_render_wp_login_option() {
if ( get_option( 'fictioneer_show_wp_login_link' ) ) {
add_action( 'fictioneer_modal_login_option', 'fictioneer_render_wp_login_option', 20 );
}
// =============================================================================
// OUTPUT WP-SIGNUP "PAGE"
// =============================================================================
/**
* Outputs the start of the page wrapper HTML for wp-signup on multi-sites
*
* @since 5.18.1
*
* @param int|null $args['post_id'] Optional. Current post ID.
* @param int|null $args['story_id'] Optional. Current story ID (if chapter).
* @param string|boolean $args['header_image_url'] URL of the filtered header image or false.
* @param array $args['header_args'] Arguments passed to the header.php partial.
*/
function fictioneer_wp_signup_start( $args ) {
// Start HTML ---> ?>
<main id="main" class="main singular wp-signup">
<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="singular-wp-signup" class="singular__article padding-left padding-right padding-top padding-bottom">
<section class="singular__content content-section">
<?php // <--- End HTML
}
if ( FICTIONEER_IS_WP_SIGNUP ) {
add_action( 'fictioneer_site', 'fictioneer_wp_signup_start', 999 );
}
/**
* Outputs the end of the page wrapper HTML for wp-signup on multi-sites
*
* @since 5.18.1
*
* @param int|null $args['post_id'] Optional. Current post ID.
*/
function fictioneer_wp_signup_end( $args ) {
// Start HTML ---> ?>
</section>
<footer class="singular__footer"><?php do_action( 'fictioneer_singular_footer' ); ?></footer>
</article>
</div>
</main>
<?php // <--- End HTML
}
if ( FICTIONEER_IS_WP_SIGNUP ) {
add_action( 'fictioneer_after_main', 'fictioneer_wp_signup_end', 999 );
}