Allow chapter index popup menu on hidden posts

The menu will still not list the chapter by default, but showing the menu does not hurt anyone.
This commit is contained in:
Tetrakern 2024-10-12 03:25:04 +02:00
parent fccf2d63b4
commit d4ba3ca2c9
3 changed files with 0 additions and 35 deletions

View File

@ -443,7 +443,6 @@ function child_treat_scheduled_chapters_as_published( $statuses ) {
return $statuses;
}
add_filter( 'fictioneer_filter_simple_chapter_list_items_statuses', 'child_treat_scheduled_chapters_as_published' );
add_filter( 'fictioneer_filter_chapter_index_popup_menu_statuses', 'child_treat_scheduled_chapters_as_published' );
add_filter( 'fictioneer_filter_chapter_nav_buttons_allowed_statuses', 'child_treat_scheduled_chapters_as_published' );
add_filter( 'fictioneer_filter_get_story_data_indexed_chapter_statuses', 'child_treat_scheduled_chapters_as_published' );
add_filter( 'fictioneer_filter_allowed_chapter_permalinks', 'child_treat_scheduled_chapters_as_published' );

View File

@ -415,26 +415,6 @@ Filters the array of allowed post statuses for the chapter subscribe button in t
---
### `apply_filters( 'fictioneer_filter_chapter_index_popup_menu_statuses', $statuses, $post_id, $story_id )`
Filters the array of allowed post statuses for the chapter index popup menu in the `fictioneer_chapter_index_popup_menu()` function. The default is `['publish']`, but you could add `'private'` or `'future'` if you want to allow the menu to render with these statuses.
**Parameters:**
* $statuses (array) Array of allowed post statuses.
* $post_id (int) Current post ID.
* $story_id (int) Story ID of the chapter.
**Example:**
```php
function child_add_scheduled_chapters_to_index_popup( $statuses ) {
$statuses[] = 'future';
return $statuses;
}
add_filter( 'fictioneer_filter_chapter_index_popup_menu_statuses', 'child_add_scheduled_chapters_to_index_popup' );
```
---
### `apply_filters( 'fictioneer_filter_chapter_media_buttons_statuses', $statuses, $post_id )`
Filters the array of allowed post statuses for the chapter media buttons in the `fictioneer_chapter_media_buttons()` function. The default is `['publish']`, but you could add `'private'` or `'future'` if you want to allow the buttons to render with these statuses.

View File

@ -437,20 +437,6 @@ 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',
['publish'],
get_the_ID(),
$args['story_post']
);
// Do not render on hidden posts
if ( ! in_array( $post_status, $allowed_statuses ) ) {
return;
}
// Abort if there is no story assigned
if ( ! $args['story_post'] ) {
return;