From bae3ca8bb9bcbb50e7ec624f2260146bb203a572 Mon Sep 17 00:00:00 2001 From: Tetrakern <26898880+Tetrakern@users.noreply.github.com> Date: Sun, 27 Oct 2024 13:03:27 +0100 Subject: [PATCH] Clean up code --- includes/functions/_utility.php | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/includes/functions/_utility.php b/includes/functions/_utility.php index 87b58d96..4391d7f7 100644 --- a/includes/functions/_utility.php +++ b/includes/functions/_utility.php @@ -1233,6 +1233,27 @@ if ( ! function_exists( 'fictioneer_is_editor' ) ) { // GET META FIELDS // ============================================================================= +if ( ! function_exists( 'fictioneer_get_story_chapter_ids' ) ) { + /** + * Wrapper for get_post_meta() to get story chapter IDs + * + * @since 5.8.2 + * + * @param int $post_id Optional. The ID of the post the field belongs to. + * Defaults to current post ID. + * + * @return array Array of chapter post IDs or an empty array. + */ + + function fictioneer_get_story_chapter_ids( $post_id = null ) { + // Setup + $chapter_ids = get_post_meta( $post_id ?? get_the_ID(), 'fictioneer_story_chapters', true ); + + // Always return an array + return is_array( $chapter_ids ) ? $chapter_ids : []; + } +} + if ( ! function_exists( 'fictioneer_count_words' ) ) { /** * Returns word count of a post @@ -1257,27 +1278,6 @@ if ( ! function_exists( 'fictioneer_count_words' ) ) { } } -if ( ! function_exists( 'fictioneer_get_story_chapter_ids' ) ) { - /** - * Wrapper for get_post_meta() to get story chapter IDs - * - * @since 5.8.2 - * - * @param int $post_id Optional. The ID of the post the field belongs to. - * Defaults to current post ID. - * - * @return array Array of chapter post IDs or an empty array. - */ - - function fictioneer_get_story_chapter_ids( $post_id = null ) { - // Setup - $chapter_ids = get_post_meta( $post_id ?? get_the_ID(), 'fictioneer_story_chapters', true ); - - // Always return an array - return is_array( $chapter_ids ) ? $chapter_ids : []; - } -} - if ( ! function_exists( 'fictioneer_get_word_count' ) ) { /** * Wrapper for get_post_meta() to get word count