Renamed header partials, hooks, and functions
This better reflects what they do, now that there are multiple options.
This commit is contained in:
parent
896344873f
commit
22e3eec51c
@ -572,8 +572,8 @@ Fires outside the `#site` container and before the `wp_footer` hook, near the en
|
||||
|
||||
---
|
||||
|
||||
### `do_action( 'fictioneer_header', $args )`
|
||||
Fires right after opening the default `<header>` container. Normally includes the header background image.
|
||||
### `do_action( 'fictioneer_inner_header', $args )`
|
||||
Fires right after opening the inner `<header>` container. Normally includes a background image.
|
||||
|
||||
**$args:**
|
||||
* $post_id (int|null) – Current post ID. Unsafe.
|
||||
@ -582,7 +582,7 @@ Fires right after opening the default `<header>` container. Normally includes th
|
||||
* $header_args (array) – Arguments passed to the header.php partial.
|
||||
|
||||
**Hooked actions:**
|
||||
* `fictioneer_header_background( $args )` – Header background image. Priority 10.
|
||||
* `fictioneer_header_inner_background( $args )` – Header background image. Priority 10.
|
||||
|
||||
---
|
||||
|
||||
@ -817,7 +817,7 @@ Fires right after opening the `#site` container in the `header.php` template. In
|
||||
|
||||
**Hooked actions:**
|
||||
* `fictioneer_navigation_bar( $args )` – HTML for the navigation bar. Priority 10.
|
||||
* `fictioneer_site_header( $args )` – HTML for the site header. Priority 20.
|
||||
* `fictioneer_inner_header( $args )` – HTML for the inner header. Priority 20.
|
||||
|
||||
---
|
||||
|
||||
|
@ -209,31 +209,6 @@ function fictioneer_navigation_bar( $args ) {
|
||||
}
|
||||
add_action( 'fictioneer_site', 'fictioneer_navigation_bar', 10 );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT SITE HEADER
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Outputs the HTML for the site header
|
||||
*
|
||||
* @since Fictioneer 5.0.0
|
||||
*
|
||||
* @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_site_header( $args ) {
|
||||
// Abort if...
|
||||
if ( ! in_array( get_theme_mod( 'header_style', 'default' ), ['default', 'split'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'partials/_site-header', null, $args );
|
||||
}
|
||||
add_action( 'fictioneer_site', 'fictioneer_site_header', 20 );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT TOP HEADER
|
||||
// =============================================================================
|
||||
@ -255,10 +230,38 @@ function fictioneer_top_header( $args ) {
|
||||
return;
|
||||
}
|
||||
|
||||
get_template_part( 'partials/_top-header', null, $args );
|
||||
get_template_part( 'partials/_header-top', null, $args );
|
||||
}
|
||||
add_action( 'fictioneer_site', 'fictioneer_top_header', 9 );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT INNER HEADER
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Outputs the HTML for the inner header
|
||||
*
|
||||
* @since Fictioneer 5.0.0
|
||||
*
|
||||
* @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_inner_header( $args ) {
|
||||
// Abort if...
|
||||
if ( ! in_array( get_theme_mod( 'header_style', 'default' ), ['default', 'split'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( get_theme_mod( 'header_style', 'default' ) ) {
|
||||
default:
|
||||
get_template_part( 'partials/_header-inner', null, $args );
|
||||
}
|
||||
}
|
||||
add_action( 'fictioneer_site', 'fictioneer_inner_header', 20 );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT HEADER BACKGROUND
|
||||
// =============================================================================
|
||||
@ -274,7 +277,7 @@ add_action( 'fictioneer_site', 'fictioneer_top_header', 9 );
|
||||
* @param array $args['header_args'] Arguments passed to the header.php partial.
|
||||
*/
|
||||
|
||||
function fictioneer_header_background( $args ) {
|
||||
function fictioneer_inner_header_background( $args ) {
|
||||
// Abort if...
|
||||
if ( ! ( $args['header_image_url'] ?? 0 ) ) {
|
||||
return;
|
||||
@ -288,7 +291,7 @@ function fictioneer_header_background( $args ) {
|
||||
</div>
|
||||
<?php // <--- End HTML
|
||||
}
|
||||
add_action( 'fictioneer_header', 'fictioneer_header_background', 10 );
|
||||
add_action( 'fictioneer_inner_header', 'fictioneer_inner_header_background', 10 );
|
||||
|
||||
// =============================================================================
|
||||
// SORT, ORDER & FILTER QUERIES
|
||||
|
@ -27,7 +27,7 @@ $tag = get_theme_mod( 'header_style', 'default' ) === 'default' ? 'header' : 'di
|
||||
|
||||
<<?php echo $tag; ?> class="header hide-on-fullscreen">
|
||||
|
||||
<?php do_action( 'fictioneer_header', $args ); ?>
|
||||
<?php do_action( 'fictioneer_inner_header', $args ); ?>
|
||||
|
||||
<?php if ( get_theme_mod( 'header_style', 'default' ) === 'default' ) : ?>
|
||||
<div class="header__content">
|
Loading…
x
Reference in New Issue
Block a user