Allow chapter navigation buttons to be rendered in other statuses #50

Merged
iniznet merged 6 commits from refactor/fictioneer_chapter_nav_buttons into main 2024-09-26 17:55:10 +08:00
Showing only changes of commit 56a434a4c9 - Show all commits

View File

@ -316,7 +316,13 @@ function fictioneer_chapter_nav_buttons( $args, $location ) {
$unlisted = get_post_meta( $post_id, 'fictioneer_chapter_hidden', true );
// Filter allowed status
$allowed_statuses = apply_filters( 'fictioneer_filter_chapter_nav_buttons_allowed_statuses', array( 'publish' ), $post_id, $args, $location );
$allowed_statuses = apply_filters(
'fictioneer_filter_chapter_nav_buttons_allowed_statuses',
['publish'],
$post_id,
$args,
$location
);
// Do not render on hidden posts
if ( ! in_array( $post_status, $allowed_statuses ) ) {
@ -374,7 +380,7 @@ function fictioneer_chapter_subscribe_button() {
$subscribe_buttons = fictioneer_get_subscribe_options();
$post_status = get_post_status( get_the_ID() );
$allowed_statuses = apply_filters( 'fictioneer_filter_chapter_subscribe_button_statuses', array( 'publish' ), get_the_ID() );
$allowed_statuses = apply_filters( 'fictioneer_filter_chapter_subscribe_button_statuses', ['publish'], get_the_ID() );
// Do not render on hidden posts
if ( ! in_array( $post_status, $allowed_statuses ) ) {
@ -433,7 +439,12 @@ add_action( 'fictioneer_chapter_actions_top_center', 'fictioneer_chapter_fullscr
function fictioneer_chapter_index_popup_menu( $args ) {
$post_status = get_post_status( get_the_ID() );
$allowed_statuses = apply_filters( 'fictioneer_filter_chapter_index_popup_menu_statuses', array( 'publish' ), get_the_ID(), $args['story_post'] );
$allowed_statuses = apply_filters(
'fictioneer_filter_chapter_index_popup_menu_statuses',
['publish'],
get_the_ID(),
$args['story_post']
);
// Do not render on hidden posts
if ( ! in_array( $post_status, $allowed_statuses ) ) {
@ -503,7 +514,7 @@ add_action( 'fictioneer_chapter_actions_bottom_center', 'fictioneer_chapter_book
function fictioneer_chapter_media_buttons() {
$post_status = get_post_status( get_the_ID() );
$allowed_statuses = apply_filters( 'fictioneer_filter_chapter_media_buttons_statuses', array( 'publish' ), get_the_ID() );
$allowed_statuses = apply_filters( 'fictioneer_filter_chapter_media_buttons_statuses', ['publish'], get_the_ID() );
// Do not render on hidden posts
if ( ! in_array( $post_status, $allowed_statuses ) ) {