Added args to fictioneer_body and fictioneer_site hooks
This commit is contained in:
parent
4c57df693a
commit
5972e85ff3
@ -177,8 +177,10 @@ Fires after `wp_body_open()` in the `<body>` right before the inline storage ele
|
||||
|
||||
**$args:**
|
||||
* $post_id (int|null) – Current post ID. Unsafe.
|
||||
* $post_type (string|null) – Current post type. Unsafe.
|
||||
* $story_id (int|null) – Current story ID (if chapter). Unsafe.
|
||||
* $header_image_url (string|boolean) – URL of the filtered header image or false.
|
||||
* $header_image_source (string) – Source of the header image. Either `default`, `post`, or `story`.
|
||||
* $header_args (array) – Arguments passed to the header.php partial.
|
||||
|
||||
**Hooked Actions:**
|
||||
@ -1010,8 +1012,10 @@ Fires right after opening the `#site` container in the `header.php` template. In
|
||||
|
||||
**$args:**
|
||||
* $post_id (int|null) – Current post ID . Unsafe.
|
||||
* $post_type (string|null) – Current post type. Unsafe.
|
||||
* $post_id (story_id|null) – Current story ID (if chapter). Unsafe.
|
||||
* $header_image_url (string|boolean) – URL of the filtered header image or false.
|
||||
* $header_image_source (string) – Source of the header image. Either `default`, `post`, or `story`.
|
||||
* $header_args (array) – Arguments passed to the header.php partial.
|
||||
|
||||
**Hooked Actions:**
|
||||
|
10
header.php
10
header.php
@ -57,12 +57,14 @@ if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_MU_REGISTRATION ) {
|
||||
<?php
|
||||
// Setup
|
||||
$story_id = null;
|
||||
$post_type = $post_id ? $post->post_type : null;
|
||||
$header_image_source = 'default';
|
||||
$header_image_url = get_header_image();
|
||||
|
||||
// If this is a content page...
|
||||
if ( ! empty( $post_id ) ) {
|
||||
if ( $post_id ) {
|
||||
// Type?
|
||||
switch ( $post->post_type ) {
|
||||
switch ( $post_type ) {
|
||||
case 'fcn_story':
|
||||
$story_id = $post_id;
|
||||
break;
|
||||
@ -75,9 +77,11 @@ if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_MU_REGISTRATION ) {
|
||||
if ( get_post_meta( $post_id, 'fictioneer_custom_header_image', true ) ) {
|
||||
$header_image_url = get_post_meta( $post_id, 'fictioneer_custom_header_image', true );
|
||||
$header_image_url = wp_get_attachment_image_url( $header_image_url, 'full' );
|
||||
$header_image_source = 'post';
|
||||
} elseif ( ! empty( $story_id ) && get_post_meta( $story_id, 'fictioneer_custom_header_image', true ) ) {
|
||||
$header_image_url = get_post_meta( $story_id, 'fictioneer_custom_header_image', true );
|
||||
$header_image_url = wp_get_attachment_image_url( $header_image_url, 'full' );
|
||||
$header_image_source = 'story';
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,8 +93,10 @@ if ( ( $args['no_index'] ?? 0 ) || FICTIONEER_MU_REGISTRATION ) {
|
||||
// Action arguments
|
||||
$action_args = array(
|
||||
'post_id' => $post_id,
|
||||
'post_type' => $post_type,
|
||||
'story_id' => $story_id,
|
||||
'header_image_url' => $header_image_url,
|
||||
'header_image_source' => $header_image_source,
|
||||
'header_args' => $args ?? []
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user