Replace fictioneer_post_header_open action with filter
This commit is contained in:
parent
5488718a68
commit
1c53bc1dae
12
ACTIONS.md
12
ACTIONS.md
@ -874,18 +874,6 @@ Fires inside the `.post__footer-right` container within the article footer in th
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### `do_action( 'fictioneer_post_header_open', $post_id, $args )`
|
|
||||||
Fires right after the post header is opened in the `_post.php` partial and `single-post.php` template, before anything else is rendered. Mind the render context, which can be `'loop'`, `'shortcode_fictioneer_blog'`, or `'single-post'`.
|
|
||||||
|
|
||||||
**Parameter:**
|
|
||||||
* $post_id (int) – The ID of the post.
|
|
||||||
|
|
||||||
**$args:**
|
|
||||||
* `context` (string) – Render context of the partial.
|
|
||||||
* `nested` (boolean|null) – Optional. Whether the post is nested inside another query.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### `do_action( 'fictioneer_recommendation_after_header', $args )`
|
### `do_action( 'fictioneer_recommendation_after_header', $args )`
|
||||||
Fires right after the article header (title, fandom, genres, and characters) in the `single-fcn_recommendation.php` template, inside the `<article>` container and just before the content section.
|
Fires right after the article header (title, fandom, genres, and characters) in the `single-fcn_recommendation.php` template, inside the `<article>` container and just before the content section.
|
||||||
|
|
||||||
|
13
FILTERS.md
13
FILTERS.md
@ -1144,6 +1144,19 @@ Filters the intermediate output array in the `_card-post.php` partial before it
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### `apply_filters( 'fictioneer_filter_post_header_items', $output, $post_id, $args )`
|
||||||
|
Filters the intermediate output array of header items in the `_post.php` partial and `single-post.php` template before it is imploded and rendered. Mind the render context, which can be `'loop'`, `'shortcode_fictioneer_blog'`, or `'single-post'`.
|
||||||
|
|
||||||
|
**$output:**
|
||||||
|
* `title` (string) – The post title.
|
||||||
|
* `meta` (string) – The post meta row.
|
||||||
|
|
||||||
|
**$args:**
|
||||||
|
* `context` (string) – Render context of the partial.
|
||||||
|
* `nested` (boolean|null) – Optional. Whether the post is nested inside another query.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### `apply_filters( 'fictioneer_filter_post_meta_items', $output, $args )`
|
### `apply_filters( 'fictioneer_filter_post_meta_items', $output, $args )`
|
||||||
Filters the intermediate output array of the `fictioneer_get_post_meta_items()` function before it is imploded and returned.
|
Filters the intermediate output array of the `fictioneer_get_post_meta_items()` function before it is imploded and returned.
|
||||||
|
|
||||||
|
@ -39,9 +39,16 @@ if (
|
|||||||
<?php do_action( 'fictioneer_post_article_open', $post_id, $args ); ?>
|
<?php do_action( 'fictioneer_post_article_open', $post_id, $args ); ?>
|
||||||
|
|
||||||
<header class="post__header">
|
<header class="post__header">
|
||||||
<?php do_action( 'fictioneer_post_header_open', $post_id, $args ); ?>
|
<?php
|
||||||
<h2 class="post__title h1"><a href="<?php the_permalink(); ?>"><?php echo $title; ?></a></h2>
|
$header_items = array(
|
||||||
<div class="post__meta layout-links"><?php echo fictioneer_get_post_meta_items(); ?></div>
|
'title' => '<h2 class="post__title h1"><a href="' . get_the_permalink() . '">' . $title . '</a></h2>',
|
||||||
|
'meta' => '<div class="post__meta layout-links">' . fictioneer_get_post_meta_items() . '</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$header_items = apply_filters( 'fictioneer_filter_post_header_items', $header_items, $post_id, $args );
|
||||||
|
|
||||||
|
echo implode( '', $header_items );
|
||||||
|
?>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="post__main content-section"><?php echo $content; ?></section>
|
<section class="post__main content-section"><?php echo $content; ?></section>
|
||||||
|
@ -37,9 +37,21 @@ get_header();
|
|||||||
<?php do_action( 'fictioneer_post_article_open', $post->ID, array( 'context' => 'single-post' ) ); ?>
|
<?php do_action( 'fictioneer_post_article_open', $post->ID, array( 'context' => 'single-post' ) ); ?>
|
||||||
|
|
||||||
<header class="post__header">
|
<header class="post__header">
|
||||||
<?php do_action( 'fictioneer_post_header_open', $post->ID, array( 'context' => 'single-post' ) ); ?>
|
<?php
|
||||||
<h1 class="post__title"><?php echo $title; ?></h1>
|
$header_items = array(
|
||||||
<div class="post__meta layout-links"><?php echo fictioneer_get_post_meta_items(); ?></div>
|
'title' => '<h1 class="post__title">' . $title . '</h1>',
|
||||||
|
'meta' => '<div class="post__meta layout-links">' . fictioneer_get_post_meta_items() . '</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$header_items = apply_filters(
|
||||||
|
'fictioneer_filter_post_header_items',
|
||||||
|
$header_items,
|
||||||
|
$post->ID,
|
||||||
|
array( 'context' => 'single-post' )
|
||||||
|
);
|
||||||
|
|
||||||
|
echo implode( '', $header_items );
|
||||||
|
?>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="post__main content-section"><?php the_content(); ?></section>
|
<section class="post__main content-section"><?php the_content(); ?></section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user