Replace fictioneer_get_field with get_post_meta
This wrapper made sense at some point in the past, now it was just unnecessary overhead.
This commit is contained in:
parent
c8b142367c
commit
b65e8ccea1
10
header.php
10
header.php
@ -80,16 +80,16 @@ if ( is_archive() || is_search() || is_404() ) {
|
||||
$story_id = $post_id;
|
||||
break;
|
||||
case 'fcn_chapter':
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story' );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
break;
|
||||
}
|
||||
|
||||
// Custom header image?
|
||||
if ( fictioneer_get_field( 'fictioneer_custom_header_image', $post_id ) ) {
|
||||
$header_image_url = fictioneer_get_field( 'fictioneer_custom_header_image', $post_id );
|
||||
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' );
|
||||
} elseif ( ! empty( $story_id ) && fictioneer_get_field( 'fictioneer_custom_header_image', $story_id ) ) {
|
||||
$header_image_url = fictioneer_get_field( 'fictioneer_custom_header_image', $story_id );
|
||||
} 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' );
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
// Setup
|
||||
$author_id = get_post_field( 'post_author', $story_id );
|
||||
$author_url = get_the_author_meta( 'user_url', $author_id );
|
||||
$co_author_ids = fictioneer_get_field( 'fictioneer_story_co_authors', $story_id );
|
||||
$language = fictioneer_get_field( 'fictioneer_story_language', $story_id );
|
||||
$co_author_ids = get_post_meta( $story_id, 'fictioneer_story_co_authors', true );
|
||||
$language = get_post_meta( $story_id, 'fictioneer_story_language', true );
|
||||
$node = [];
|
||||
|
||||
// Identity
|
||||
@ -77,7 +77,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
|
||||
// Content
|
||||
$content = get_the_content( null, false, $story_id );
|
||||
$description = fictioneer_get_field( 'fictioneer_story_short_description', $story_id );
|
||||
$description = get_post_meta( $story_id, 'fictioneer_story_short_description', true );
|
||||
$node['content'] = $content;
|
||||
$node['description'] = strip_shortcodes( $description );
|
||||
|
||||
@ -96,7 +96,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
'hotlinkAllowed' => FICTIONEER_API_STORYGRAPH_HOTLINK,
|
||||
);
|
||||
$cover = get_the_post_thumbnail_url( $story_id, 'full' );
|
||||
$header = fictioneer_get_field( 'fictioneer_custom_header_image', $story_id );
|
||||
$header = get_post_meta( $story_id, 'fictioneer_custom_header_image', true );
|
||||
$header = wp_get_attachment_image_url( $header, 'full' );
|
||||
|
||||
if ( ! empty( $header ) ) {
|
||||
@ -148,20 +148,20 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
$chapter_id = get_the_ID();
|
||||
|
||||
// Skip not visible chapters
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) {
|
||||
if ( get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Data
|
||||
$author_id = get_the_author_meta( 'id' );
|
||||
$author_url = get_the_author_meta( 'user_url' );
|
||||
$co_author_ids = fictioneer_get_field( 'fictioneer_chapter_co_authors', $chapter_id );
|
||||
$group = fictioneer_get_field( 'fictioneer_chapter_group', $chapter_id );
|
||||
$rating = fictioneer_get_field( 'fictioneer_chapter_rating', $chapter_id );
|
||||
$language = fictioneer_get_field( 'fictioneer_chapter_language', $chapter_id );
|
||||
$prefix = fictioneer_get_field( 'fictioneer_chapter_prefix', $chapter_id );
|
||||
$no_chapter = fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter_id );
|
||||
$warning = fictioneer_get_field( 'fictioneer_chapter_warning', $chapter_id );
|
||||
$co_author_ids = get_post_meta( $chapter_id, 'fictioneer_chapter_co_authors', true );
|
||||
$group = get_post_meta( $chapter_id, 'fictioneer_chapter_group', true );
|
||||
$rating = get_post_meta( $chapter_id, 'fictioneer_chapter_rating', true );
|
||||
$language = get_post_meta( $chapter_id, 'fictioneer_chapter_language', true );
|
||||
$prefix = get_post_meta( $chapter_id, 'fictioneer_chapter_prefix', true );
|
||||
$no_chapter = get_post_meta( $chapter_id, 'fictioneer_chapter_no_chapter', true );
|
||||
$warning = get_post_meta( $chapter_id, 'fictioneer_chapter_warning', true );
|
||||
|
||||
// Chapter identity
|
||||
$chapter = [];
|
||||
@ -220,7 +220,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
$chapter['published'] = get_post_time( 'U', true );
|
||||
$chapter['modified'] = get_post_modified_time( 'U', true );
|
||||
$chapter['protected'] = post_password_required();
|
||||
$chapter['words'] = intval( fictioneer_get_field( '_word_count', $chapter_id ) );
|
||||
$chapter['words'] = intval( get_post_meta( $chapter_id, '_word_count', true ) );
|
||||
$chapter['nonChapter'] = ! empty( $no_chapter );
|
||||
|
||||
if ( ! empty( $rating ) ) {
|
||||
|
@ -379,16 +379,16 @@ if ( ! function_exists( 'fictioneer_refresh_post_caches' ) ) {
|
||||
|
||||
// Purge parent story (if any)...
|
||||
if ( $post_type == 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( ! empty( $story_id ) ) {
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true );
|
||||
|
||||
delete_post_meta( $story_id, 'fictioneer_story_data_collection' );
|
||||
fictioneer_purge_post_cache( $story_id );
|
||||
|
||||
// ... and associated chapters
|
||||
if ( ! empty( $chapters ) ) {
|
||||
if ( is_array( $chapters ) && ! empty( $chapters ) ) {
|
||||
foreach ( $chapters as $chapter_id ) {
|
||||
fictioneer_purge_post_cache( $chapter_id );
|
||||
}
|
||||
@ -398,9 +398,9 @@ if ( ! function_exists( 'fictioneer_refresh_post_caches' ) ) {
|
||||
|
||||
// Purge associated chapters
|
||||
if ( $post_type == 'fcn_story' ) {
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $post_id );
|
||||
$chapters = get_post_meta( $post_id, 'fictioneer_story_chapters', true );
|
||||
|
||||
if ( ! empty( $chapters ) ) {
|
||||
if ( is_array( $chapters ) && ! empty( $chapters ) ) {
|
||||
foreach ( $chapters as $chapter_id ) {
|
||||
fictioneer_purge_post_cache( $chapter_id );
|
||||
}
|
||||
@ -618,7 +618,7 @@ if ( ! function_exists( 'fictioneer_track_chapter_and_story_updates' ) ) {
|
||||
|
||||
// Get story ID from post or parent story (if any)
|
||||
$post_type = get_post_type( $post_id ); // Not all hooks get the $post object!
|
||||
$story_id = $post_type == 'fcn_story' ? $post_id : fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = $post_type == 'fcn_story' ? $post_id : get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
// If there is a story...
|
||||
if ( ! empty( $story_id ) ) {
|
||||
|
@ -630,19 +630,19 @@ if ( ! function_exists( 'fictioneer_get_subscribe_options' ) ) {
|
||||
function fictioneer_get_subscribe_options( $post_id = null, $author_id = null, $feed = null ) {
|
||||
// Setup
|
||||
$post_id = $post_id ? $post_id : get_the_ID();
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
$author_id = $author_id ? $author_id : get_the_author_meta( 'ID' );
|
||||
$patreon_link = fictioneer_get_field( 'fictioneer_patreon_link', $post_id );
|
||||
$kofi_link = fictioneer_get_field( 'fictioneer_kofi_link', $post_id );
|
||||
$subscribestar_link = fictioneer_get_field( 'fictioneer_subscribestar_link', $post_id );
|
||||
$patreon_link = get_post_meta( $post_id, 'fictioneer_patreon_link', true );
|
||||
$kofi_link = get_post_meta( $post_id, 'fictioneer_kofi_link', true );
|
||||
$subscribestar_link = get_post_meta( $post_id, 'fictioneer_subscribestar_link', true );
|
||||
$output = [];
|
||||
$feed = get_option( 'fictioneer_enable_theme_rss' ) ? $feed: null;
|
||||
|
||||
// Look for story support links if none provided by post
|
||||
if ( ! empty( $story_id ) ) {
|
||||
if ( empty( $patreon_link ) ) $patreon_link = fictioneer_get_field( 'fictioneer_patreon_link', $story_id );
|
||||
if ( empty( $kofi_link ) ) $kofi_link = fictioneer_get_field( 'fictioneer_kofi_link', $story_id );
|
||||
if ( empty( $subscribestar_link ) ) $subscribestar_link = fictioneer_get_field( 'fictioneer_subscribestar_link', $story_id );
|
||||
if ( empty( $patreon_link ) ) $patreon_link = get_post_meta( $story_id, 'fictioneer_patreon_link', true );
|
||||
if ( empty( $kofi_link ) ) $kofi_link = get_post_meta( $story_id, 'fictioneer_kofi_link', true );
|
||||
if ( empty( $subscribestar_link ) ) $subscribestar_link = get_post_meta( $story_id, 'fictioneer_subscribestar_link', true );
|
||||
}
|
||||
|
||||
// Look for author support links if none provided by post or story
|
||||
@ -732,12 +732,12 @@ if ( ! function_exists( 'fictioneer_get_story_buttons' ) ) {
|
||||
// Setup
|
||||
$story_data = $args['story_data'];
|
||||
$story_id = $args['story_id'];
|
||||
$ebook_upload = fictioneer_get_field( 'fictioneer_story_ebook_upload_one', $story_id ); // Attachment ID
|
||||
$ebook_upload = get_post_meta( $story_id, 'fictioneer_story_ebook_upload_one', true ); // Attachment ID
|
||||
$subscribe_buttons = fictioneer_get_subscribe_options();
|
||||
$output = [];
|
||||
|
||||
// Flags
|
||||
$show_epub_download = $story_data['chapter_count'] > 0 && fictioneer_get_field( 'fictioneer_story_epub_preface', $story_id ) && get_option( 'fictioneer_enable_epubs' ) && ! fictioneer_get_field( 'fictioneer_story_no_epub', $story_id );
|
||||
$show_epub_download = $story_data['chapter_count'] > 0 && get_post_meta( $story_id, 'fictioneer_story_epub_preface', true ) && get_option( 'fictioneer_enable_epubs' ) && ! get_post_meta( $story_id, 'fictioneer_story_no_epub', true );
|
||||
$can_follows = get_option( 'fictioneer_enable_follows' );
|
||||
$can_reminders = get_option( 'fictioneer_enable_reminders' );
|
||||
$show_login = get_option( 'fictioneer_enable_oauth' ) && ! is_user_logged_in();
|
||||
@ -833,7 +833,7 @@ if ( ! function_exists( 'fictioneer_get_chapter_author_nodes' ) ) {
|
||||
|
||||
function fictioneer_get_chapter_author_nodes( $chapter_id ) {
|
||||
// Setup
|
||||
$all_authors = fictioneer_get_field( 'fictioneer_chapter_co_authors', $chapter_id ) ?? [];
|
||||
$all_authors = get_post_meta( $chapter_id, 'fictioneer_chapter_co_authors', true ) ?? [];
|
||||
$all_authors = is_array( $all_authors ) ? $all_authors : [];
|
||||
array_unshift( $all_authors, get_post_field( 'post_author', $chapter_id ) );
|
||||
|
||||
@ -968,7 +968,7 @@ if ( ! function_exists( 'fictioneer_get_chapter_list_items' ) ) {
|
||||
|
||||
function fictioneer_get_chapter_list_items( $story_id, $data, $current_index ) {
|
||||
// Setup
|
||||
$hide_icons = fictioneer_get_field( 'fictioneer_story_hide_chapter_icons', $story_id ) || get_option( 'fictioneer_hide_chapter_icons' );
|
||||
$hide_icons = get_post_meta( $story_id, 'fictioneer_story_hide_chapter_icons', true ) || get_option( 'fictioneer_hide_chapter_icons' );
|
||||
|
||||
$query_args = array(
|
||||
'post__in' => fictioneer_rescue_array_zero( $data['chapter_ids'] ), // Only visible and published
|
||||
@ -989,9 +989,9 @@ if ( ! function_exists( 'fictioneer_get_chapter_list_items' ) ) {
|
||||
// Prepare
|
||||
$classes = [];
|
||||
$title = trim( $post->post_title );
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $post->ID );
|
||||
$list_title = get_post_meta( $post->ID, 'fictioneer_chapter_list_title', true );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon', $post->ID );
|
||||
$text_icon = get_post_meta( $post->ID, 'fictioneer_chapter_text_icon', true );
|
||||
$parsed_url = wp_parse_url( home_url() );
|
||||
$relative_path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '';
|
||||
|
||||
@ -1147,7 +1147,7 @@ if ( ! function_exists( 'fictioneer_get_rss_link' ) ) {
|
||||
$feed = esc_url( add_query_arg( 'story_id', $post_id, home_url( 'feed/rss-chapters' ) ) );
|
||||
break;
|
||||
case 'fcn_chapter':
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
if ( $story_id ) {
|
||||
$feed = esc_url( add_query_arg( 'story_id', $story_id, home_url( 'feed/rss-chapters' ) ) );
|
||||
};
|
||||
@ -1513,8 +1513,8 @@ if ( ! function_exists( 'fictioneer_echo_card' ) ) {
|
||||
switch ( $type ) {
|
||||
case 'fcn_chapter':
|
||||
if (
|
||||
fictioneer_get_field( 'fictioneer_chapter_hidden', get_the_ID() ) ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_no_chapter', get_the_ID() )
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_hidden', true ) ||
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_no_chapter', true )
|
||||
) {
|
||||
get_template_part( 'partials/_card-hidden', null, $args );
|
||||
} else {
|
||||
@ -1522,7 +1522,7 @@ if ( ! function_exists( 'fictioneer_echo_card' ) ) {
|
||||
}
|
||||
break;
|
||||
case 'fcn_story':
|
||||
if ( fictioneer_get_field( 'fictioneer_story_hidden', get_the_ID() ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) {
|
||||
get_template_part( 'partials/_card-hidden', null, $args );
|
||||
} else {
|
||||
get_template_part( 'partials/_card-story', null, $args );
|
||||
@ -1571,36 +1571,36 @@ if ( ! function_exists( 'fictioneer_get_support_links' ) ) {
|
||||
|
||||
// Get story ID if chapter and parent ID not given
|
||||
if ( $parent_id === null && get_post_type( $post_id ) == 'fcn_chapter' ) {
|
||||
$parent_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$parent_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
}
|
||||
|
||||
// Post level (e.g. chapter)
|
||||
$links['topwebfiction'] = fictioneer_get_field( 'fictioneer_story_topwebfiction_link', $post_id );
|
||||
$links['patreon'] = fictioneer_get_field( 'fictioneer_patreon_link', $post_id );
|
||||
$links['kofi'] = fictioneer_get_field( 'fictioneer_kofi_link', $post_id );
|
||||
$links['subscribestar'] = fictioneer_get_field( 'fictioneer_subscribestar_link', $post_id );
|
||||
$links['paypal'] = fictioneer_get_field( 'fictioneer_paypal_link', $post_id );
|
||||
$links['donation'] = fictioneer_get_field( 'fictioneer_donation_link', $post_id );
|
||||
$links['topwebfiction'] = get_post_meta( $post_id, 'fictioneer_story_topwebfiction_link', true );
|
||||
$links['patreon'] = get_post_meta( $post_id, 'fictioneer_patreon_link', true );
|
||||
$links['kofi'] = get_post_meta( $post_id, 'fictioneer_kofi_link', true );
|
||||
$links['subscribestar'] = get_post_meta( $post_id, 'fictioneer_subscribestar_link', true );
|
||||
$links['paypal'] = get_post_meta( $post_id, 'fictioneer_paypal_link', true );
|
||||
$links['donation'] = get_post_meta( $post_id, 'fictioneer_donation_link', true );
|
||||
|
||||
// Parent level (e.g. story)
|
||||
if ( ! empty( $parent_id ) ) {
|
||||
if ( empty( $links['topwebfiction'] ) ) {
|
||||
$links['topwebfiction'] = fictioneer_get_field( 'fictioneer_story_topwebfiction_link', $parent_id );
|
||||
$links['topwebfiction'] = get_post_meta( $parent_id, 'fictioneer_story_topwebfiction_link', true );
|
||||
}
|
||||
if ( empty( $links['patreon'] ) ) {
|
||||
$links['patreon'] = fictioneer_get_field( 'fictioneer_patreon_link', $parent_id );
|
||||
$links['patreon'] = get_post_meta( $parent_id, 'fictioneer_patreon_link', true );
|
||||
}
|
||||
if ( empty( $links['kofi'] ) ) {
|
||||
$links['kofi'] = fictioneer_get_field( 'fictioneer_kofi_link', $parent_id );
|
||||
$links['kofi'] = get_post_meta( $parent_id, 'fictioneer_kofi_link', true );
|
||||
}
|
||||
if ( empty( $links['subscribestar'] ) ) {
|
||||
$links['subscribestar'] = fictioneer_get_field( 'fictioneer_subscribestar_link', $parent_id );
|
||||
$links['subscribestar'] = get_post_meta( $parent_id, 'fictioneer_subscribestar_link', true );
|
||||
}
|
||||
if ( empty( $links['paypal'] ) ) {
|
||||
$links['paypal'] = fictioneer_get_field( 'fictioneer_paypal_link', $parent_id );
|
||||
$links['paypal'] = get_post_meta( $parent_id, 'fictioneer_paypal_link', true );
|
||||
}
|
||||
if ( empty( $links['donation'] ) ) {
|
||||
$links['donation'] = fictioneer_get_field( 'fictioneer_donation_link', $parent_id );
|
||||
$links['donation'] = get_post_meta( $parent_id, 'fictioneer_donation_link', true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ function fictioneer_post_comment_to_discord( $comment_id, $comment_approved ) {
|
||||
}
|
||||
|
||||
// Is chapter with story?
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post->ID );
|
||||
$story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( $story_id ) {
|
||||
$message['embeds'][0]['footer'] = array(
|
||||
@ -198,7 +198,7 @@ function fictioneer_post_story_to_discord( $post_id ) {
|
||||
}
|
||||
|
||||
// Already triggered once?
|
||||
if ( ! empty( fictioneer_get_field( 'fictioneer_discord_post_trigger', $post_id ) ) ) {
|
||||
if ( ! empty( get_post_meta( $post_id, 'fictioneer_discord_post_trigger', true ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -286,12 +286,12 @@ function fictioneer_post_chapter_to_discord( $post_id ) {
|
||||
}
|
||||
|
||||
// Already triggered once?
|
||||
if ( ! empty( fictioneer_get_field( 'fictioneer_discord_post_trigger', $post_id ) ) ) {
|
||||
if ( ! empty( get_post_meta( $post_id, 'fictioneer_discord_post_trigger', true ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Story?
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
$story_status = get_post_status( $story_id );
|
||||
$story_title = get_the_title( $story_id );
|
||||
$story_url = get_permalink( $story_id );
|
||||
|
@ -47,11 +47,11 @@ if ( ! function_exists( 'fictioneer_download_epub' ) ) {
|
||||
// Count downloads per ePUB version
|
||||
if ( $story_id ) {
|
||||
// Download counter(s)
|
||||
$downloads = fictioneer_get_field( 'fictioneer_epub_downloads', $story_id );
|
||||
$downloads = get_post_meta( $story_id, 'fictioneer_epub_downloads', true );
|
||||
$downloads = is_array( $downloads ) ? $downloads : [];
|
||||
|
||||
// Generate version key based on timestamp
|
||||
$key = md5( fictioneer_get_field( 'fictioneer_epub_timestamp', $story_id ) );
|
||||
$key = md5( get_post_meta( $story_id, 'fictioneer_epub_timestamp', true ) );
|
||||
|
||||
// Is this version already tracked?
|
||||
$downloads[ $key ] = ( $downloads[ $key ] ?? 0 ) + 1;
|
||||
@ -240,7 +240,7 @@ if ( ! function_exists( 'fictioneer_prepare_build_directory' ) ) {
|
||||
|
||||
// Copy/Edit CSS file
|
||||
$css_path = $epub_dir . '/OEBPS/Styles/style.css';
|
||||
$css_edit = fictioneer_get_field( 'fictioneer_story_epub_custom_css', $story_id, false );
|
||||
$css_edit = get_post_meta( $story_id, 'fictioneer_story_epub_custom_css', true );
|
||||
|
||||
copy( $dir . '_build/templates/style.css', $css_path );
|
||||
|
||||
@ -367,14 +367,14 @@ if ( ! function_exists( 'fictioneer_add_epub_chapters' ) ) {
|
||||
// Process chapters
|
||||
foreach ( $chapter_query->posts as $post ) {
|
||||
// Skip if...
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_no_chapter', $post->ID ) ) {
|
||||
if ( get_post_meta( $post->ID, 'fictioneer_chapter_no_chapter', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$content = apply_filters( 'the_content', $post->post_content );
|
||||
$is_hidden = fictioneer_get_field( 'fictioneer_chapter_hidden', $post->ID );
|
||||
$is_hidden = get_post_meta( $post->ID, 'fictioneer_chapter_hidden', true );
|
||||
$processed = false;
|
||||
$index++;
|
||||
|
||||
@ -419,7 +419,7 @@ if ( ! function_exists( 'fictioneer_add_epub_chapters' ) ) {
|
||||
$head->appendChild( $doc->createElement( 'title', $title ) );
|
||||
|
||||
// Add title to frame if not hidden
|
||||
if ( ! fictioneer_get_field( 'fictioneer_chapter_hide_title' ) ) {
|
||||
if ( ! get_post_meta( $post->ID, 'fictioneer_chapter_hide_title', true ) ) {
|
||||
$frame->appendChild( $doc->createElement( 'h1', $title ) );
|
||||
}
|
||||
|
||||
@ -697,7 +697,7 @@ if ( ! function_exists( 'fictioneer_generate_epub_opf' ) ) {
|
||||
}
|
||||
|
||||
// Afterword node
|
||||
if ( fictioneer_get_field( 'fictioneer_story_epub_afterword', $story_id, false ) ) {
|
||||
if ( get_post_meta( $story_id, 'fictioneer_story_epub_afterword', true ) ) {
|
||||
$m_item = $opf->createElement( 'item' );
|
||||
$m_item->setAttribute( 'href', 'Text/afterword.html' );
|
||||
$m_item->setAttribute( 'id', 'afterword' );
|
||||
@ -775,7 +775,7 @@ if ( ! function_exists( 'fictioneer_generate_epub_ncx' ) ) {
|
||||
}
|
||||
|
||||
// Add afterword node
|
||||
if ( fictioneer_get_field( 'fictioneer_story_epub_afterword', $story_id, false ) ) {
|
||||
if ( get_post_meta( $story_id, 'fictioneer_story_epub_afterword', true ) ) {
|
||||
$navmap->appendChild( fictioneer_nav_point( $ncx, $index, 'Text/afterword.html', __( 'Afterword', 'fictioneer' ) ) );
|
||||
$index++;
|
||||
}
|
||||
@ -1012,7 +1012,7 @@ function fictioneer_generate_epub() {
|
||||
if (
|
||||
empty( $story_id ) ||
|
||||
! get_option( 'fictioneer_enable_epubs' ) ||
|
||||
fictioneer_get_field( 'fictioneer_story_no_epub', $story_id )
|
||||
get_post_meta( $story_id, 'fictioneer_story_no_epub', true )
|
||||
) {
|
||||
fictioneer_epub_return_and_exit();
|
||||
}
|
||||
@ -1036,14 +1036,14 @@ function fictioneer_generate_epub() {
|
||||
$story = get_post( $story_id );
|
||||
$dir = get_template_directory() . '/epubs/';
|
||||
$folder = "{$story_id}";
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true ) ?: [];
|
||||
$author = get_the_author_meta( 'display_name', $story->post_author );
|
||||
$co_authors = fictioneer_get_field( 'fictioneer_story_co_authors', $story_id ) ?? [];
|
||||
$co_authors = get_post_meta( $story_id, 'fictioneer_story_co_authors', true ) ?: [];
|
||||
$all_authors = [];
|
||||
$short_description = mb_convert_encoding( fictioneer_get_content_field( 'fictioneer_story_short_description', $story_id, false ), 'HTML-ENTITIES', 'UTF-8' );
|
||||
$short_description = fictioneer_fix_html_entities( $short_description );
|
||||
$story_last_modified = get_the_modified_date( 'Y-m-d H:i:s', $story_id );
|
||||
$epub_last_built = fictioneer_get_field( 'fictioneer_epub_timestamp', $story_id );
|
||||
$epub_last_built = get_post_meta( $story_id, 'fictioneer_epub_timestamp', true );
|
||||
$toc_list = [];
|
||||
$ncx_list = [];
|
||||
$opf_list = [];
|
||||
|
@ -54,7 +54,7 @@ function fictioneer_get_metabox_checkbox( $post, $meta_key, $label, $args = [] )
|
||||
|
||||
<div class="fictioneer-meta-checkbox__checkbox">
|
||||
<input type="hidden" name="<?php echo $meta_key; ?>" value="0" autocomplete="off">
|
||||
<input type="checkbox" id="<?php echo $meta_key; ?>" name="<?php echo $meta_key; ?>" value="1" autocomplete="off" <?php checked( fictioneer_get_field( $meta_key, $post->ID ), 1 ); ?> <?php echo $attributes; ?> <?php echo $required; ?>>
|
||||
<input type="checkbox" id="<?php echo $meta_key; ?>" name="<?php echo $meta_key; ?>" value="1" autocomplete="off" <?php checked( get_post_meta( $post->ID, $meta_key, true ), 1 ); ?> <?php echo $attributes; ?> <?php echo $required; ?>>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" focusable="false"><path d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"></path></svg>
|
||||
</div>
|
||||
|
||||
@ -87,7 +87,7 @@ function fictioneer_get_metabox_checkbox( $post, $meta_key, $label, $args = [] )
|
||||
|
||||
function fictioneer_get_metabox_text( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = esc_attr( fictioneer_get_field( $meta_key, $post->ID ) );
|
||||
$meta_value = esc_attr( get_post_meta( $post->ID, $meta_key, true ) );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
$placeholder = strval( $args['placeholder'] ?? '' );
|
||||
@ -142,7 +142,7 @@ function fictioneer_get_metabox_text( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_url( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = esc_attr( fictioneer_get_field( $meta_key, $post->ID ) );
|
||||
$meta_value = esc_attr( get_post_meta( $post->ID, $meta_key, true ) );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
$placeholder = strval( $args['placeholder'] ?? '' );
|
||||
@ -197,7 +197,7 @@ function fictioneer_get_metabox_url( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_array( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$array = fictioneer_get_field( $meta_key, $post->ID );
|
||||
$array = get_post_meta( $post->ID, $meta_key, true );
|
||||
$array = is_array( $array ) ? $array : [];
|
||||
$list = esc_attr( implode( ', ', $array ) );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
@ -251,7 +251,7 @@ function fictioneer_get_metabox_array( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_select( $post, $meta_key, $options, $args = [] ) {
|
||||
// Setup
|
||||
$selected = absint( fictioneer_get_field( $meta_key, $post->ID ) );
|
||||
$selected = absint( get_post_meta( $post->ID, $meta_key, true ) );
|
||||
$selected = empty( $selected ) ? array_keys( $options )[0] : $selected;
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
@ -312,7 +312,7 @@ function fictioneer_get_metabox_select( $post, $meta_key, $options, $args = [] )
|
||||
|
||||
function fictioneer_get_metabox_textarea( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = fictioneer_get_field( $meta_key, $post->ID );
|
||||
$meta_value = get_post_meta( $post->ID, $meta_key, true );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
$placeholder = strval( $args['placeholder'] ?? '' );
|
||||
@ -366,7 +366,7 @@ function fictioneer_get_metabox_textarea( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_image( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = fictioneer_get_field( $meta_key, $post->ID );
|
||||
$meta_value = get_post_meta( $post->ID, $meta_key, true );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
$upload = strval( $args['button'] ?? _x( 'Set image', 'Metabox image upload button.', 'fictioneer' ) );
|
||||
@ -425,7 +425,7 @@ function fictioneer_get_metabox_image( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_ebook( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = fictioneer_get_field( $meta_key, $post->ID );
|
||||
$meta_value = get_post_meta( $post->ID, $meta_key, true );
|
||||
$file_path = get_attached_file( $meta_value );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
@ -523,7 +523,7 @@ function fictioneer_get_metabox_ebook( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_tokens( $post, $meta_key, $options, $args = [] ) {
|
||||
// Setup
|
||||
$array = fictioneer_get_field( $meta_key, $post->ID );
|
||||
$array = get_post_meta( $post->ID, $meta_key, true );
|
||||
$array = is_array( $array ) ? $array : [];
|
||||
$list = esc_attr( implode( ', ', $array ) );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
@ -595,7 +595,7 @@ function fictioneer_get_metabox_tokens( $post, $meta_key, $options, $args = [] )
|
||||
|
||||
function fictioneer_get_metabox_icons( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = esc_attr( fictioneer_get_field( $meta_key, $post->ID ) );
|
||||
$meta_value = esc_attr( get_post_meta( $post->ID, $meta_key, true ) );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
$placeholder = strval( $args['placeholder'] ?? '' );
|
||||
@ -667,7 +667,7 @@ function fictioneer_get_metabox_icons( $post, $meta_key, $args = [] ) {
|
||||
|
||||
function fictioneer_get_metabox_editor( $post, $meta_key, $args = [] ) {
|
||||
// Setup
|
||||
$meta_value = fictioneer_get_field( $meta_key, $post->ID );
|
||||
$meta_value = get_post_meta( $post->ID, $meta_key, true );
|
||||
$label = strval( $args['label'] ?? '' );
|
||||
$description = strval( $args['description'] ?? '' );
|
||||
$required = ( $args['required'] ?? 0 ) ? 'required' : '';
|
||||
@ -962,7 +962,7 @@ function fictioneer_callback_relationship_chapters( $selected, $meta_key, $args
|
||||
$title = fictioneer_get_safe_title( $chapter );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-values-item'];
|
||||
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID ) ) {
|
||||
if ( get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true ) ) {
|
||||
$title = "{$title} (" . _x( 'Unlisted', 'Chapter assignment flag.', 'fictioneer' ) . ")";
|
||||
}
|
||||
|
||||
@ -1051,7 +1051,7 @@ function fictioneer_ajax_get_relationship_chapters( $post_id, $meta_key ) {
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-source-item'];
|
||||
|
||||
// Update title if necessary
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID ) ) {
|
||||
if ( get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true ) ) {
|
||||
$title = "{$title} (" . _x( 'Unlisted', 'Chapter assignment flag.', 'fictioneer' ) . ")";
|
||||
}
|
||||
|
||||
@ -1109,11 +1109,11 @@ function fictioneer_ajax_get_relationship_chapters( $post_id, $meta_key ) {
|
||||
|
||||
function fictioneer_get_relationship_chapter_details( $chapter ) {
|
||||
// Setup
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon', $chapter->ID );
|
||||
$text_icon = get_post_meta( $chapter->ID, 'fictioneer_chapter_text_icon', true );
|
||||
$icon = fictioneer_get_icon_field( 'fictioneer_chapter_icon', $chapter->ID );
|
||||
$rating = fictioneer_get_field( 'fictioneer_chapter_rating', $chapter->ID );
|
||||
$warning = fictioneer_get_field( 'fictioneer_chapter_warning', $chapter->ID );
|
||||
$group = fictioneer_get_field( 'fictioneer_chapter_group', $chapter->ID );
|
||||
$rating = get_post_meta( $chapter->ID, 'fictioneer_chapter_rating', true );
|
||||
$warning = get_post_meta( $chapter->ID, 'fictioneer_chapter_warning', true );
|
||||
$group = get_post_meta( $chapter->ID, 'fictioneer_chapter_group', true );
|
||||
$flags = [];
|
||||
$status_labels = array(
|
||||
'draft' => get_post_status_object( 'draft' )->label,
|
||||
@ -1129,11 +1129,11 @@ function fictioneer_get_relationship_chapter_details( $chapter ) {
|
||||
// Build
|
||||
$info[] = empty( $text_icon ) ? sprintf( '<i class="%s"></i>', $icon ) : "<strong>{$text_icon}</strong>";
|
||||
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID ) ) {
|
||||
if ( get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true ) ) {
|
||||
$flags[] = _x( 'Unlisted', 'Chapter assignment flag.', 'fictioneer' );
|
||||
}
|
||||
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter->ID ) ) {
|
||||
if ( get_post_meta( $chapter->ID, 'fictioneer_chapter_no_chapter', true ) ) {
|
||||
$flags[] = _x( 'No Chapter', 'Chapter assignment flag.', 'fictioneer' );
|
||||
}
|
||||
|
||||
@ -1905,7 +1905,7 @@ function fictioneer_render_story_data_metabox( $post ) {
|
||||
);
|
||||
|
||||
// Chapters
|
||||
$chapter_ids = fictioneer_get_field( 'fictioneer_story_chapters', $post->ID ) ?: [];
|
||||
$chapter_ids = get_post_meta( $post->ID, 'fictioneer_story_chapters', true ) ?: [];
|
||||
$chapter_ids = is_array( $chapter_ids ) ? $chapter_ids : [];
|
||||
$chapters = empty( $chapter_ids ) ? [] : get_posts(
|
||||
array(
|
||||
@ -1936,7 +1936,7 @@ function fictioneer_render_story_data_metabox( $post ) {
|
||||
|
||||
// Custom pages
|
||||
if ( current_user_can( 'fcn_story_pages', $post->ID ) && FICTIONEER_MAX_CUSTOM_PAGES_PER_STORY > 0 ) {
|
||||
$page_ids = fictioneer_get_field( 'fictioneer_story_custom_pages', $post->ID ) ?: [];
|
||||
$page_ids = get_post_meta( $post->ID, 'fictioneer_story_custom_pages', true ) ?: [];
|
||||
$page_ids = is_array( $page_ids ) ? $page_ids : [];
|
||||
$pages = empty( $page_ids ) ? [] : get_posts(
|
||||
array(
|
||||
@ -2220,7 +2220,7 @@ function fictioneer_save_story_metaboxes( $post_id ) {
|
||||
|
||||
// Chapters
|
||||
if ( isset( $_POST['fictioneer_story_chapters'] ) && current_user_can( 'edit_fcn_stories', $post_id ) ) {
|
||||
$previous_chapter_ids = fictioneer_get_field( 'fictioneer_story_chapters', $post_id );
|
||||
$previous_chapter_ids = get_post_meta( $post_id, 'fictioneer_story_chapters', true );
|
||||
$previous_chapter_ids = is_array( $previous_chapter_ids ) ? $previous_chapter_ids : [];
|
||||
|
||||
$chapter_ids = $_POST['fictioneer_story_chapters'];
|
||||
@ -2568,7 +2568,7 @@ function fictioneer_render_chapter_data_metabox( $post ) {
|
||||
|
||||
$nonce = wp_create_nonce( "chapter_meta_data_{$post->ID}" ); // Accounts for manual wp_update_post() calls!
|
||||
$post_author_id = get_post_field( 'post_author', $post->ID );
|
||||
$current_story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post->ID );
|
||||
$current_story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
|
||||
$output = [];
|
||||
|
||||
// --- Add fields ------------------------------------------------------------
|
||||
@ -2844,7 +2844,7 @@ function fictioneer_save_chapter_metaboxes( $post_id ) {
|
||||
// Story
|
||||
if ( isset( $_POST['fictioneer_chapter_story'] ) ) {
|
||||
$story_id = absint( $_POST['fictioneer_chapter_story'] );
|
||||
$current_story_id = absint( fictioneer_get_field( 'fictioneer_chapter_story', $post_id ) );
|
||||
$current_story_id = absint( get_post_meta( $post_id, 'fictioneer_chapter_story', true ) );
|
||||
|
||||
if ( $story_id ) {
|
||||
$story_author_id = get_post_field( 'post_author', $story_id );
|
||||
@ -2942,7 +2942,7 @@ function fictioneer_append_chapter_to_story( $post_id, $story_id ) {
|
||||
}
|
||||
|
||||
// Get current story chapters
|
||||
$story_chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$story_chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true );
|
||||
|
||||
// Prepare chapter array if null (or broken)
|
||||
if ( ! is_array( $story_chapters ) ) {
|
||||
@ -3483,7 +3483,7 @@ function fictioneer_render_featured_content_metabox( $post ) {
|
||||
// --- Add fields --------------------------------------------------------------
|
||||
|
||||
// Featured items
|
||||
$item_ids = fictioneer_get_field( 'fictioneer_post_featured', $post->ID ) ?: [];
|
||||
$item_ids = get_post_meta( $post->ID, 'fictioneer_post_featured', true ) ?: [];
|
||||
$item_ids = is_array( $item_ids ) ? $item_ids : [];
|
||||
$items = empty( $item_ids ) ? [] : get_posts(
|
||||
array(
|
||||
@ -3616,7 +3616,7 @@ add_action( 'save_post', 'fictioneer_save_post_metaboxes' );
|
||||
function fictioneer_update_post_relationship_registry( $post_id ) {
|
||||
// Setup
|
||||
$registry = fictioneer_get_relationship_registry();
|
||||
$featured = fictioneer_get_field( 'fictioneer_post_featured', $post_id );
|
||||
$featured = get_post_meta( $post_id, 'fictioneer_post_featured', true );
|
||||
|
||||
// Update relationships
|
||||
$registry[ $post_id ] = [];
|
||||
@ -3715,7 +3715,7 @@ function fictioneer_render_collection_data_metabox( $post ) {
|
||||
);
|
||||
|
||||
// Collection items
|
||||
$item_ids = fictioneer_get_field( 'fictioneer_collection_items', $post->ID ) ?: [];
|
||||
$item_ids = get_post_meta( $post->ID, 'fictioneer_collection_items', true ) ?: [];
|
||||
$item_ids = is_array( $item_ids ) ? $item_ids : [];
|
||||
$items = empty( $item_ids ) ? [] : get_posts(
|
||||
array(
|
||||
|
@ -26,7 +26,7 @@ function fictioneer_update_modified_date_on_story_for_chapter( $post_id ) {
|
||||
}
|
||||
|
||||
// Setup
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
// No linked story found
|
||||
if ( empty( $story_id ) || ! get_post_status( $story_id ?? 0 ) ) {
|
||||
@ -97,7 +97,7 @@ function fictioneer_store_original_publish_date( $post_id, $post ) {
|
||||
}
|
||||
|
||||
// Get first publish date (if set)
|
||||
$first_publish_date = fictioneer_get_field( 'fictioneer_first_publish_date', $post_id );
|
||||
$first_publish_date = get_post_meta( $post_id, 'fictioneer_first_publish_date', true );
|
||||
|
||||
// Set if missing
|
||||
if ( empty( $first_publish_date ) || strtotime( $first_publish_date ) === false ) {
|
||||
@ -122,7 +122,7 @@ add_action( 'save_post', 'fictioneer_store_original_publish_date', 10, 2 );
|
||||
|
||||
function fictioneer_get_story_changelog( $story_id ) {
|
||||
// Setup
|
||||
$changelog = fictioneer_get_field( 'fictioneer_story_changelog', $story_id );
|
||||
$changelog = get_post_meta( $story_id, 'fictioneer_story_changelog', true );
|
||||
$changelog = is_array( $changelog ) ? $changelog : [];
|
||||
|
||||
// Initialize
|
||||
@ -215,7 +215,7 @@ function fictioneer_log_story_chapter_status_changes( $new_status, $old_status,
|
||||
}
|
||||
|
||||
// Story?
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post->ID );
|
||||
$story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( empty( $story_id ) ) {
|
||||
return;
|
||||
@ -282,15 +282,15 @@ function fictioneer_remove_chapter_from_story( $chapter_id ) {
|
||||
}
|
||||
|
||||
// Story?
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $chapter_id );
|
||||
$story_id = get_post_meta( $chapter_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( empty( $story_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check chapter list
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$previous = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true ) ?: [];
|
||||
$previous = get_post_meta( $story_id, 'fictioneer_story_chapters', true ) ?: [];
|
||||
|
||||
if ( empty( $chapters ) || ! in_array( $chapter_id, $chapters ) ) {
|
||||
return;
|
||||
|
@ -88,7 +88,7 @@ if ( ! function_exists( 'fictioneer_get_card_list' ) ) {
|
||||
if ( $post_type === 'fcn_story' ) {
|
||||
// Story hidden?
|
||||
foreach ( $all_query->posts as $candidate ) {
|
||||
if ( fictioneer_get_field( 'fictioneer_story_hidden', $candidate->ID ) ) {
|
||||
if ( get_post_meta( $candidate->ID, 'fictioneer_story_hidden', true ) ) {
|
||||
$excluded[] = $candidate->ID;
|
||||
}
|
||||
}
|
||||
@ -96,8 +96,8 @@ if ( ! function_exists( 'fictioneer_get_card_list' ) ) {
|
||||
// Chapter hidden or excluded?
|
||||
foreach ( $all_query->posts as $candidate ) {
|
||||
if (
|
||||
fictioneer_get_field( 'fictioneer_chapter_hidden', $candidate->ID ) ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_no_chapter', $candidate->ID )
|
||||
get_post_meta( $candidate->ID, 'fictioneer_chapter_hidden', true ) ||
|
||||
get_post_meta( $candidate->ID, 'fictioneer_chapter_no_chapter', true )
|
||||
) {
|
||||
$excluded[] = $candidate->ID;
|
||||
}
|
||||
@ -134,7 +134,7 @@ if ( ! function_exists( 'fictioneer_get_card_list' ) ) {
|
||||
|
||||
switch ( $post_type ) {
|
||||
case 'fcn_story':
|
||||
if ( fictioneer_get_field( 'fictioneer_story_hidden', get_the_ID() ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) {
|
||||
get_template_part( 'partials/_card-hidden', null, $the_card_args );
|
||||
} else {
|
||||
get_template_part( $card_partial, null, $the_card_args );
|
||||
@ -142,8 +142,8 @@ if ( ! function_exists( 'fictioneer_get_card_list' ) ) {
|
||||
break;
|
||||
case 'fcn_chapter':
|
||||
if (
|
||||
fictioneer_get_field( 'fictioneer_chapter_hidden', get_the_ID() ) ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_no_chapter', get_the_ID() )
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_hidden', true ) ||
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_no_chapter', true )
|
||||
) {
|
||||
get_template_part( 'partials/_card-hidden', null, $the_card_args );
|
||||
} else {
|
||||
|
@ -1321,7 +1321,7 @@ if ( ! current_user_can( 'manage_options' ) ) {
|
||||
|
||||
function fictioneer_prevent_publish_date_update( $data, $postarr ) {
|
||||
// Setup
|
||||
$first_publish_date = fictioneer_get_field( 'fictioneer_first_publish_date', $postarr['ID'] );
|
||||
$first_publish_date = get_post_meta( $postarr['ID'], 'fictioneer_first_publish_date', true );
|
||||
|
||||
// Remove from update array if already published once
|
||||
if ( ! empty( $first_publish_date ) ) {
|
||||
|
@ -324,7 +324,7 @@ function fictioneer_output_schemas( $post_id = null ) {
|
||||
|
||||
// Setup
|
||||
$post_id = empty( $post_id ) ? get_queried_object_id() : $post_id;
|
||||
$schema = fictioneer_get_field( 'fictioneer_schema', $post_id );
|
||||
$schema = get_post_meta( $post_id, 'fictioneer_schema', true );
|
||||
|
||||
// No schema found...
|
||||
if ( ! $schema ) {
|
||||
|
@ -54,16 +54,16 @@ if ( ! function_exists( 'fictioneer_seo_fields' ) ) {
|
||||
|
||||
function fictioneer_seo_fields( $post ) {
|
||||
// Title
|
||||
$seo_title = fictioneer_get_field( 'fictioneer_seo_title', $post->ID ) ?: '';
|
||||
$seo_title = get_post_meta( $post->ID, 'fictioneer_seo_title', true );
|
||||
$seo_title_placeholder = fictioneer_get_safe_title( $post->ID );
|
||||
|
||||
// Description (truncated if necessary)
|
||||
$seo_description = fictioneer_get_field( 'fictioneer_seo_description', $post->ID ) ?: '';
|
||||
$seo_description = get_post_meta( $post->ID, 'fictioneer_seo_description', true );
|
||||
$seo_description_placeholder = wp_strip_all_tags( get_the_excerpt( $post ), true );
|
||||
$seo_description_placeholder = mb_strimwidth( $seo_description_placeholder, 0, 155, '…' );
|
||||
|
||||
// Open Graph image...
|
||||
$seo_og_image = fictioneer_get_field( 'fictioneer_seo_og_image', $post->ID );
|
||||
$seo_og_image = get_post_meta( $post->ID, 'fictioneer_seo_og_image', true );
|
||||
$seo_og_image_display = wp_get_attachment_url( $seo_og_image );
|
||||
$image_source = '';
|
||||
|
||||
@ -75,7 +75,7 @@ if ( ! function_exists( 'fictioneer_seo_fields' ) ) {
|
||||
|
||||
// ... if not found, look for parent thumbnail...
|
||||
if ( ! $seo_og_image_display && $post->post_type === 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post->ID );
|
||||
$story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( $story_id && has_post_thumbnail( $story_id ) ) {
|
||||
$seo_og_image_display = get_the_post_thumbnail_url( $story_id );
|
||||
@ -305,14 +305,14 @@ if ( ! function_exists( 'fictioneer_get_seo_title' ) ) {
|
||||
}
|
||||
|
||||
// Cached title?
|
||||
$cache = fictioneer_get_field( 'fictioneer_seo_title_cache', $post_id );
|
||||
$cache = get_post_meta( $post_id, 'fictioneer_seo_title_cache', true );
|
||||
|
||||
if ( ! empty( $cache ) && ! $skip_cache ) {
|
||||
return $cache;
|
||||
}
|
||||
|
||||
// Start building...
|
||||
$seo_title = fictioneer_get_field( 'fictioneer_seo_title', $post_id );
|
||||
$seo_title = get_post_meta( $post_id, 'fictioneer_seo_title', true );
|
||||
$seo_title = empty( $seo_title ) ? false : $seo_title;
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$default = empty( $default ) ? $title : $default;
|
||||
@ -460,14 +460,14 @@ if ( ! function_exists( 'fictioneer_get_seo_description' ) ) {
|
||||
}
|
||||
|
||||
// Cached description?
|
||||
$cache = fictioneer_get_field( 'fictioneer_seo_description_cache', $post_id );
|
||||
$cache = get_post_meta( $post_id, 'fictioneer_seo_description_cache', true );
|
||||
|
||||
if ( ! empty( $cache ) && ! $skip_cache ) {
|
||||
return $cache;
|
||||
}
|
||||
|
||||
// Start building...
|
||||
$seo_description = fictioneer_get_field( 'fictioneer_seo_description', $post_id );
|
||||
$seo_description = get_post_meta( $post_id, 'fictioneer_seo_description', true );
|
||||
$seo_description = empty( $seo_description ) ? false : $seo_description;
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$excerpt = wp_strip_all_tags( get_the_excerpt( $post_id ), true );
|
||||
@ -476,7 +476,7 @@ if ( ! function_exists( 'fictioneer_get_seo_description' ) ) {
|
||||
|
||||
// Special Case: Recommendations
|
||||
if ( get_post_type( $post_id ) == 'fcn_recommendation' ) {
|
||||
$one_sentence = fictioneer_get_field( 'fictioneer_recommendation_one_sentence', $post_id ) ?? '';
|
||||
$one_sentence = get_post_meta( $post_id, 'fictioneer_recommendation_one_sentence', true ) ?? '';
|
||||
$one_sentence = trim( $one_sentence );
|
||||
|
||||
$default = empty( $one_sentence ) ? $default : $one_sentence;
|
||||
@ -550,7 +550,7 @@ if ( ! function_exists( 'fictioneer_get_seo_image' ) ) {
|
||||
|
||||
// Cached image? Except for site default, which can globally change!
|
||||
if ( ! $use_default ) {
|
||||
$cache = fictioneer_get_field( 'fictioneer_seo_og_image_cache', $post_id );
|
||||
$cache = get_post_meta( $post_id, 'fictioneer_seo_og_image_cache', true );
|
||||
|
||||
if ( $cache ) {
|
||||
return $cache;
|
||||
@ -559,7 +559,7 @@ if ( ! function_exists( 'fictioneer_get_seo_image' ) ) {
|
||||
|
||||
// Get image ID if not yet set
|
||||
if ( ! $image_id ) {
|
||||
$image_id = fictioneer_get_field( 'fictioneer_seo_og_image', $post_id );
|
||||
$image_id = get_post_meta( $post_id, 'fictioneer_seo_og_image', true );
|
||||
$image_id = wp_attachment_is_image( $image_id ) ? $image_id : false;
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ if ( ! function_exists( 'fictioneer_get_seo_image' ) ) {
|
||||
|
||||
// Try story thumbnail if chapter...
|
||||
if ( ! $image_id && get_post_type( $post_id ) == 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
$image_id = has_post_thumbnail( $story_id ) ? get_post_thumbnail_id( $story_id ) : $image_id;
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ function fictioneer_output_head_seo() {
|
||||
$post_id = get_queried_object_id(); // In archives and search, this is the first post
|
||||
$post_type = get_post_type(); // In archives and search, this is the first post
|
||||
$post_author = $post->post_author ?? 0;
|
||||
$chapter_story_id = fictioneer_get_field( 'fictioneer_chapter_story' ) ?? 0;
|
||||
$chapter_story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
$canonical_url = wp_get_canonical_url(); // Unreliable on aggregated pages
|
||||
|
||||
// Flags
|
||||
@ -644,7 +644,7 @@ function fictioneer_output_head_seo() {
|
||||
|
||||
// Special Case: Recommendation author
|
||||
if ( $post_author && $show_author && $post_type == 'fcn_recommendation' ) {
|
||||
$article_author = fictioneer_get_field( 'fictioneer_recommendation_author', $post_id ) ?? $article_author;
|
||||
$article_author = get_post_meta( $post_id, 'fictioneer_recommendation_author', true ) ?? $article_author;
|
||||
}
|
||||
|
||||
// Special Case: Archives
|
||||
@ -679,8 +679,8 @@ function fictioneer_output_head_seo() {
|
||||
|
||||
// Get co-authors (if any)
|
||||
$co_authors = $post_type == 'fcn_story' ?
|
||||
fictioneer_get_field( 'fictioneer_story_co_authors', $post_id ) ?? [] :
|
||||
fictioneer_get_field( 'fictioneer_chapter_co_authors', $post_id ) ?? [];
|
||||
get_post_meta( $post_id, 'fictioneer_story_co_authors', true ) :
|
||||
get_post_meta( $post_id, 'fictioneer_chapter_co_authors', true );
|
||||
|
||||
// Add co-authors URL or name
|
||||
if ( is_array( $co_authors ) && ! empty( $co_authors ) ) {
|
||||
|
@ -898,7 +898,7 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
// Get chapters...
|
||||
if ( $story_id && empty( $chapter_ids ) ) {
|
||||
// ... via story
|
||||
$hide_icons = $hide_icons || fictioneer_get_field( 'fictioneer_story_hide_chapter_icons', $story_id );
|
||||
$hide_icons = $hide_icons || get_post_meta( $story_id, 'fictioneer_story_hide_chapter_icons', true );
|
||||
$story_data = fictioneer_get_story_data( $story_id, false ); // Does not refresh comment count!
|
||||
$chapters = $story_data['chapter_ids'];
|
||||
} elseif ( ! empty( $chapter_ids ) ) {
|
||||
@ -973,15 +973,15 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
// Setup
|
||||
$chapter_query->the_post();
|
||||
$chapter_id = get_the_ID();
|
||||
$chapter_story_id = fictioneer_get_field( 'fictioneer_chapter_story' );
|
||||
$chapter_story_id = get_post_meta( $chapter_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
// Skip not visible chapters
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) {
|
||||
if ( get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check group (if any)
|
||||
if ( $group && $group != strtolower( trim( fictioneer_get_field( 'fictioneer_chapter_group' ) ) ) ) {
|
||||
if ( $group && $group != strtolower( trim( get_post_meta( $chapter_id, 'fictioneer_chapter_group', true ) ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -999,11 +999,11 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
}
|
||||
|
||||
// Data
|
||||
$warning = fictioneer_get_field( 'fictioneer_chapter_warning' );
|
||||
$icon = fictioneer_get_icon_field( 'fictioneer_chapter_icon' );
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon' );
|
||||
$prefix = fictioneer_get_field( 'fictioneer_chapter_prefix' );
|
||||
$words = fictioneer_get_field( '_word_count', $chapter_id );
|
||||
$warning = get_post_meta( $chapter_id, 'fictioneer_chapter_warning', true );
|
||||
$icon = fictioneer_get_icon_field( 'fictioneer_chapter_icon', $chapter_id );
|
||||
$text_icon = get_post_meta( $chapter_id, 'fictioneer_chapter_text_icon', true );
|
||||
$prefix = get_post_meta( $chapter_id, 'fictioneer_chapter_prefix', true );
|
||||
$words = get_post_meta( $chapter_id, '_word_count', true );
|
||||
$title = fictioneer_get_safe_title( $chapter_id );
|
||||
|
||||
// Start HTML ---> ?>
|
||||
|
@ -209,12 +209,12 @@ function fictioneer_create_sitemap( $last_saved_id, $last_saved_post ) {
|
||||
}
|
||||
|
||||
foreach ( $stories as $post ) {
|
||||
if ( fictioneer_get_field( 'fictioneer_story_hidden', $post->ID ) ) {
|
||||
if ( get_post_meta( $post->ID, 'fictioneer_story_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$lastmod = get_the_modified_date( 'c', $post->ID );
|
||||
$status = fictioneer_get_field( 'fictioneer_story_status', $post->ID );
|
||||
$status = get_post_meta( $post->ID, 'fictioneer_story_status', true );
|
||||
$frequency = $status == 'Ongoing' ? 'weekly' : 'monthly';
|
||||
$sitemap .= fictioneer_url_node( get_permalink( $post->ID ), $lastmod, $frequency );
|
||||
}
|
||||
@ -240,7 +240,7 @@ function fictioneer_create_sitemap( $last_saved_id, $last_saved_post ) {
|
||||
}
|
||||
|
||||
foreach( $chapters as $post ) {
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden', $post->ID ) ) {
|
||||
if ( get_post_meta( $post->ID, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -704,7 +704,7 @@ function fictioneer_add_custom_scripts() {
|
||||
! is_archive() &&
|
||||
! is_search() &&
|
||||
! post_password_required() &&
|
||||
! fictioneer_get_field( 'fictioneer_disable_commenting' ) &&
|
||||
! get_post_meta( get_the_ID(), 'fictioneer_disable_commenting', true ) &&
|
||||
comments_open()
|
||||
) {
|
||||
wp_enqueue_script( 'dmp', get_template_directory_uri() . '/js/diff-match-patch.js', array(), null, true );
|
||||
|
@ -190,7 +190,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
|
||||
// Check cache
|
||||
if ( FICTIONEER_ENABLE_STORY_DATA_META_CACHE ) {
|
||||
$old_data = fictioneer_get_field( 'fictioneer_story_data_collection', $story_id );
|
||||
$old_data = get_post_meta( $story_id, 'fictioneer_story_data_collection', true );
|
||||
}
|
||||
|
||||
if ( ! empty( $old_data ) && $old_data['last_modified'] >= get_the_modified_time( 'U', $story_id ) ) {
|
||||
@ -270,13 +270,13 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
}
|
||||
|
||||
// Setup
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true ) ?: [];
|
||||
$tags = get_the_tags( $story_id );
|
||||
$fandoms = get_the_terms( $story_id, 'fcn_fandom' );
|
||||
$characters = get_the_terms( $story_id, 'fcn_character' );
|
||||
$warnings = get_the_terms( $story_id, 'fcn_content_warning' );
|
||||
$genres = get_the_terms( $story_id, 'fcn_genre' );
|
||||
$status = fictioneer_get_field( 'fictioneer_story_status', $story_id );
|
||||
$status = get_post_meta( $story_id, 'fictioneer_story_status', true );
|
||||
$icon = 'fa-solid fa-circle';
|
||||
$chapter_count = 0;
|
||||
$word_count = 0;
|
||||
@ -319,11 +319,11 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
if ( ! empty( $chapters ) && $chapters->have_posts() ) {
|
||||
foreach ( $chapters->posts as $chapter ) {
|
||||
// This is about 50 times faster than using a meta query lol
|
||||
if ( ! fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID ) ) {
|
||||
if ( ! get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true ) ) {
|
||||
// Do not count non-chapters...
|
||||
if ( ! fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter->ID ) ) {
|
||||
if ( ! get_post_meta( $chapter->ID, 'fictioneer_chapter_no_chapter', true ) ) {
|
||||
$chapter_count += 1;
|
||||
$word_count += (int) fictioneer_get_field( '_word_count', $chapter->ID );
|
||||
$word_count += (int) get_post_meta( $chapter->ID, '_word_count', true );
|
||||
}
|
||||
|
||||
// ... but they are still listed!
|
||||
@ -336,7 +336,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
}
|
||||
|
||||
// Add story word count
|
||||
$word_count += (int) fictioneer_get_field( '_word_count', $story_id );
|
||||
$word_count += (int) get_post_meta( $story_id, '_word_count', true );
|
||||
|
||||
// Prepare result
|
||||
$result = array(
|
||||
@ -353,8 +353,8 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
'warnings' => $warnings,
|
||||
'genres' => $genres,
|
||||
'title' => fictioneer_get_safe_title( $story_id ),
|
||||
'rating' => fictioneer_get_field( 'fictioneer_story_rating', $story_id ),
|
||||
'rating_letter' => fictioneer_get_field( 'fictioneer_story_rating', $story_id )[0],
|
||||
'rating' => get_post_meta( $story_id, 'fictioneer_story_rating', true ),
|
||||
'rating_letter' => get_post_meta( $story_id, 'fictioneer_story_rating', true )[0],
|
||||
'chapter_ids' => $chapter_ids,
|
||||
'last_modified' => get_the_modified_time( 'U', $story_id ),
|
||||
'comment_count' => $comment_count,
|
||||
@ -426,7 +426,7 @@ if ( ! function_exists( 'fictioneer_get_author_statistics' ) ) {
|
||||
// Filter out unwanted stories (faster than meta query)
|
||||
$stories = array_filter( $stories, function ( $post ) {
|
||||
// Story hidden?
|
||||
$story_hidden = fictioneer_get_field( 'fictioneer_story_hidden', $post->ID );
|
||||
$story_hidden = get_post_meta( $post->ID, 'fictioneer_story_hidden', true );
|
||||
|
||||
return empty( $story_hidden ) || $story_hidden === '0';
|
||||
});
|
||||
@ -447,11 +447,11 @@ if ( ! function_exists( 'fictioneer_get_author_statistics' ) ) {
|
||||
// Filter out unwanted chapters (faster than meta query)
|
||||
$chapters = array_filter( $chapters, function ( $post ) {
|
||||
// Chapter hidden?
|
||||
$chapter_hidden = fictioneer_get_field( 'fictioneer_chapter_hidden', $post->ID );
|
||||
$chapter_hidden = get_post_meta( $post->ID, 'fictioneer_chapter_hidden', true );
|
||||
$not_hidden = empty( $chapter_hidden ) || $chapter_hidden === '0';
|
||||
|
||||
// Not a chapter?
|
||||
$no_chapter = fictioneer_get_field( 'fictioneer_chapter_no_chapter', $post->ID );
|
||||
$no_chapter = get_post_meta( $post->ID, 'fictioneer_chapter_no_chapter', true );
|
||||
$is_chapter = empty( $no_chapter ) || $no_chapter === '0';
|
||||
|
||||
// Only keep if both conditions are met
|
||||
@ -463,7 +463,7 @@ if ( ! function_exists( 'fictioneer_get_author_statistics' ) ) {
|
||||
$comment_count = 0;
|
||||
|
||||
foreach ( $chapters as $chapter ) {
|
||||
$word_count += (int) fictioneer_get_field( '_word_count', $chapter->ID );
|
||||
$word_count += (int) get_post_meta( $chapter->ID, '_word_count', true );
|
||||
$comment_count += get_comments_number( $chapter );
|
||||
}
|
||||
|
||||
@ -791,31 +791,9 @@ if ( ! function_exists( 'fictioneer_is_editor' ) ) {
|
||||
// GET META FIELDS
|
||||
// =============================================================================
|
||||
|
||||
if ( ! function_exists( 'fictioneer_get_field' ) ) {
|
||||
/**
|
||||
* Wrapper for get_post_meta with single value return
|
||||
*
|
||||
* @since Fictioneer 5.0
|
||||
*
|
||||
* @param string $field Name of the meta field to retrieve.
|
||||
* @param int $post_id Optional. The ID of the post the field belongs to.
|
||||
* Defaults to current post ID.
|
||||
*
|
||||
* @return mixed The single field value.
|
||||
*/
|
||||
|
||||
function fictioneer_get_field( $field, $post_id = null ) {
|
||||
// Setup
|
||||
$post_id = $post_id ? absint( $post_id ) : get_the_ID();
|
||||
|
||||
// Retrieve post meta
|
||||
return get_post_meta( $post_id, $field, true );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'fictioneer_get_content_field' ) ) {
|
||||
/**
|
||||
* Wrapper for fictioneer_get_field with content filers applied
|
||||
* Wrapper for get_post_meta() with content filers applied
|
||||
*
|
||||
* @since Fictioneer 5.0
|
||||
*
|
||||
@ -828,7 +806,7 @@ if ( ! function_exists( 'fictioneer_get_content_field' ) ) {
|
||||
|
||||
function fictioneer_get_content_field( $field, $post_id = null ) {
|
||||
// Setup
|
||||
$content = fictioneer_get_field( $field, $post_id );
|
||||
$content = get_post_meta( $post_id ?? get_the_ID(), $field, true );
|
||||
|
||||
// Apply default filter functions from the_content (but nothing else)
|
||||
$content = wptexturize( $content );
|
||||
@ -844,7 +822,7 @@ if ( ! function_exists( 'fictioneer_get_content_field' ) ) {
|
||||
|
||||
if ( ! function_exists( 'fictioneer_get_icon_field' ) ) {
|
||||
/**
|
||||
* Wrapper for fictioneer_get_field to get Font Awesome icon class
|
||||
* Wrapper for get_post_meta() to get Font Awesome icon class
|
||||
*
|
||||
* @since Fictioneer 5.0
|
||||
*
|
||||
@ -857,7 +835,7 @@ if ( ! function_exists( 'fictioneer_get_icon_field' ) ) {
|
||||
|
||||
function fictioneer_get_icon_field( $field, $post_id = null ) {
|
||||
// Setup
|
||||
$icon = fictioneer_get_field( $field, $post_id );
|
||||
$icon = get_post_meta( $post_id ?? get_the_ID(), $field, true );
|
||||
$icon_object = json_decode( $icon ); // Check for ACF Font Awesome plugin
|
||||
|
||||
// Valid?
|
||||
@ -1420,7 +1398,6 @@ if ( ! function_exists( 'fictioneer_is_commenting_disabled' ) ) {
|
||||
* comment section but does not allow new comments to be posted.
|
||||
*
|
||||
* @since 5.0
|
||||
* @see fictioneer_get_field()
|
||||
*
|
||||
* @param int|null $post_id Post ID the comments are for. Defaults to current post ID.
|
||||
*
|
||||
@ -1431,17 +1408,17 @@ if ( ! function_exists( 'fictioneer_is_commenting_disabled' ) ) {
|
||||
// Return immediately if...
|
||||
if (
|
||||
get_option( 'fictioneer_disable_commenting' ) ||
|
||||
fictioneer_get_field( 'fictioneer_disable_commenting', $post_id )
|
||||
get_post_meta( $post_id, 'fictioneer_disable_commenting', true )
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check parent story if chapter...
|
||||
if ( get_post_type( $post_id ) === 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( $story_id ) {
|
||||
return fictioneer_get_field( 'fictioneer_disable_commenting', $story_id ) == true;
|
||||
return get_post_meta( $story_id, 'fictioneer_disable_commenting', true ) == true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1853,7 +1830,7 @@ if ( ! function_exists( 'fictioneer_get_post_author_ids' ) ) {
|
||||
*/
|
||||
|
||||
function fictioneer_get_post_author_ids( $post_id ) {
|
||||
$author_ids = fictioneer_get_field( 'fictioneer_story_co_authors', $post_id ) ?? [];
|
||||
$author_ids = get_post_meta( $post_id, 'fictioneer_story_co_authors', true ) ?: [];
|
||||
$author_ids = is_array( $author_ids ) ? $author_ids : [];
|
||||
array_unshift( $author_ids, get_post_field( 'post_author', $post_id ) );
|
||||
|
||||
|
@ -369,7 +369,7 @@ function fictioneer_output_rss( $post_id = null ) {
|
||||
}
|
||||
|
||||
// RSS Feed if chapter...
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( $post_type == 'fcn_chapter' && ! empty( $story_id ) && ! $skip_to_default ) {
|
||||
$title = sprintf(
|
||||
@ -1117,7 +1117,7 @@ function fictioneer_gate_unpublished_content() {
|
||||
|
||||
// 404 chapter of unpublished story
|
||||
if ( $post->post_type === 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post->ID );
|
||||
$story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
|
||||
|
||||
if (
|
||||
! empty( $story_id ) &&
|
||||
|
@ -42,7 +42,7 @@ function fictioneer_chapters_list( $args ) {
|
||||
while ( $args['chapters']->have_posts() ) {
|
||||
$args['chapters']->the_post();
|
||||
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_chapter_hidden', true ) ) {
|
||||
get_template_part( 'partials/_card-hidden', null, $card_args );
|
||||
} else {
|
||||
get_template_part( 'partials/_card-chapter', null, $card_args );
|
||||
@ -124,8 +124,8 @@ add_action( 'fictioneer_chapter_before_header', 'fictioneer_chapter_foreword', 1
|
||||
|
||||
function fictioneer_chapter_warnings( $args ) {
|
||||
// Setup
|
||||
$warning = fictioneer_get_field( 'fictioneer_chapter_warning', $args['chapter_id'] );
|
||||
$warning_notes = fictioneer_get_field( 'fictioneer_chapter_warning_notes', $args['chapter_id'] );
|
||||
$warning = get_post_meta( $args['chapter_id'], 'fictioneer_chapter_warning', true );
|
||||
$warning_notes = get_post_meta( $args['chapter_id'], 'fictioneer_chapter_warning_notes', true );
|
||||
|
||||
// Abort conditions
|
||||
if ( ( ! $warning && ! $warning_notes ) || post_password_required() ) {
|
||||
@ -434,7 +434,7 @@ function fictioneer_chapter_support_links( $args ) {
|
||||
// Abort conditions
|
||||
if (
|
||||
post_password_required() ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_hide_support_links', $args['chapter_id'] )
|
||||
get_post_meta( $args['chapter_id'], 'fictioneer_chapter_hide_support_links', true )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -559,7 +559,7 @@ add_action( 'fictioneer_chapter_after_main', 'fictioneer_chapter_micro_menu', 10
|
||||
|
||||
function fictioneer_chapter_paragraph_tools() {
|
||||
// Setup
|
||||
$can_comment = ! fictioneer_get_field( 'fictioneer_disable_commenting' ) && comments_open();
|
||||
$can_comment = ! get_post_meta( get_the_ID(), 'fictioneer_disable_commenting', true ) && comments_open();
|
||||
|
||||
// Start HTML ---> ?>
|
||||
<div id="paragraph-tools" class="paragraph-tools">
|
||||
@ -619,7 +619,7 @@ add_action( 'fictioneer_chapter_after_main', 'fictioneer_chapter_paragraph_tools
|
||||
|
||||
function fictioneer_chapter_suggestion_tools() {
|
||||
// Abort if...
|
||||
if ( fictioneer_get_field( 'fictioneer_disable_commenting' ) || ! comments_open() ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_disable_commenting', true ) || ! comments_open() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,15 @@ function fictioneer_add_fiction_css() {
|
||||
*/
|
||||
|
||||
$custom_css = '';
|
||||
$custom_css .= fictioneer_get_field( 'fictioneer_custom_css', get_the_ID() ) ?: '';
|
||||
$custom_css .= get_post_meta( get_the_ID(), 'fictioneer_custom_css', true );
|
||||
|
||||
if ( get_post_type( get_the_ID() ) == 'fcn_story' ) {
|
||||
$custom_css .= fictioneer_get_field( 'fictioneer_story_css', get_the_ID() ) ?: '';
|
||||
$custom_css .= get_post_meta( get_the_ID(), 'fictioneer_story_css', true );
|
||||
}
|
||||
|
||||
if ( get_post_type( get_the_ID() ) == 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', get_the_ID() );
|
||||
$custom_css .= fictioneer_get_field( 'fictioneer_story_css', $story_id );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
$custom_css .= get_post_meta( $story_id, 'fictioneer_story_css', true );
|
||||
}
|
||||
|
||||
if ( ! empty( $custom_css ) && ! preg_match( '#</?\w+#', $custom_css ) ) {
|
||||
@ -140,7 +140,7 @@ function fictioneer_output_modals( $args ) {
|
||||
|
||||
if (
|
||||
get_option( 'fictioneer_enable_suggestions' ) &&
|
||||
! fictioneer_get_field( 'fictioneer_disable_commenting' ) &&
|
||||
! get_post_meta( get_the_ID(), 'fictioneer_disable_commenting', true ) &&
|
||||
comments_open()
|
||||
) {
|
||||
?><input id="suggestions-modal-toggle" data-target="suggestions-modal" type="checkbox" tabindex="-1" class="modal-toggle" autocomplete="off" hidden><?php
|
||||
|
@ -284,7 +284,7 @@ function fictioneer_mobile_lists_panel() {
|
||||
$output = [];
|
||||
|
||||
// Chapters?
|
||||
if ( $post_type === 'fcn_chapter' && fictioneer_get_field( 'fictioneer_chapter_story' ) && ! is_search() ) {
|
||||
if ( $post_type === 'fcn_chapter' && get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true ) && ! is_search() ) {
|
||||
ob_start();
|
||||
// Start HTML ---> ?>
|
||||
<button class="mobile-menu__frame-button" data-frame-target="chapters">
|
||||
|
@ -50,7 +50,7 @@ function fictioneer_post_featured_list( $post_id ) {
|
||||
}
|
||||
|
||||
// Setup
|
||||
$featured = fictioneer_get_field( 'fictioneer_post_featured', $post_id );
|
||||
$featured = get_post_meta( $post_id, 'fictioneer_post_featured', true );
|
||||
|
||||
// Abort if...
|
||||
if ( ! is_array( $featured ) || empty( $featured ) ) {
|
||||
|
@ -143,7 +143,7 @@ add_action( 'fictioneer_recommendation_after_content', 'fictioneer_recommendatio
|
||||
|
||||
function fictioneer_recommendation_links( $args ) {
|
||||
// Setup
|
||||
$links = fictioneer_get_field( 'fictioneer_recommendation_urls', $args['recommendation_id'] );
|
||||
$links = get_post_meta( $args['recommendation_id'], 'fictioneer_recommendation_urls', true );
|
||||
$links = fictioneer_url_list_to_array( $links );
|
||||
|
||||
// Abort conditions...
|
||||
@ -183,7 +183,7 @@ add_action( 'fictioneer_recommendation_after_content', 'fictioneer_recommendatio
|
||||
|
||||
function fictioneer_recommendation_support_links( $args ) {
|
||||
// Setup
|
||||
$links = fictioneer_get_field( 'fictioneer_recommendation_support', $args['recommendation_id'] );
|
||||
$links = get_post_meta( $args['recommendation_id'], 'fictioneer_recommendation_support', true );
|
||||
$links = fictioneer_url_list_to_array( $links );
|
||||
|
||||
// Abort conditions...
|
||||
@ -203,7 +203,7 @@ function fictioneer_recommendation_support_links( $args ) {
|
||||
<h5><?php
|
||||
printf(
|
||||
_x( 'Support <em>%s</em>', 'Support _author_', 'fictioneer' ),
|
||||
fictioneer_get_field( 'fictioneer_recommendation_author', $args['recommendation_id'] )
|
||||
get_post_meta( $args['recommendation_id'], 'fictioneer_recommendation_author', true )
|
||||
)
|
||||
?></h5>
|
||||
<ul class="recommendation__list"><?php echo implode( '', $output ); ?></ul>
|
||||
|
@ -109,7 +109,7 @@ function fictioneer_stories_list( $args ) {
|
||||
while ( $args['stories']->have_posts() ) {
|
||||
$args['stories']->the_post();
|
||||
|
||||
if ( fictioneer_get_field( 'fictioneer_story_hidden' ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) {
|
||||
get_template_part( 'partials/_card-hidden', null, $card_args );
|
||||
} else {
|
||||
get_template_part( 'partials/_card-story', null, $card_args );
|
||||
@ -165,7 +165,7 @@ add_action( 'fictioneer_stories_after_content', 'fictioneer_stories_list', 30 );
|
||||
|
||||
function fictioneer_story_copyright_notice( $args ) {
|
||||
// Setup
|
||||
$copyright_notice = fictioneer_get_field( 'fictioneer_story_copyright_notice', $args['story_id'] );
|
||||
$copyright_notice = get_post_meta( $args['story_id'], 'fictioneer_story_copyright_notice', true );
|
||||
|
||||
// Abort conditions...
|
||||
if ( empty( $copyright_notice ) ) {
|
||||
@ -195,7 +195,9 @@ add_action( 'fictioneer_story_after_content', 'fictioneer_story_copyright_notice
|
||||
|
||||
function fictioneer_story_tags_and_warnings( $args ) {
|
||||
// Abort conditions...
|
||||
$tags_shown = $args['story_data']['tags'] && ! get_option( 'fictioneer_hide_tags_on_pages' ) && ! fictioneer_get_field( 'fictioneer_story_no_tags' );;
|
||||
$tags_shown = $args['story_data']['tags'] &&
|
||||
! get_option( 'fictioneer_hide_tags_on_pages' ) &&
|
||||
! get_post_meta( get_the_ID(), 'fictioneer_story_no_tags', true );
|
||||
$warnings_shown = $args['story_data']['warnings'] && ! get_option( 'fictioneer_hide_content_warnings_on_pages' );
|
||||
|
||||
if ( ! $tags_shown && ! $warnings_shown ) {
|
||||
|
@ -28,7 +28,7 @@ function fictioneer_refresh_chapter_schema( $post_id, $post ) {
|
||||
}
|
||||
|
||||
// Setup
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
|
||||
// Rebuild schema
|
||||
fictioneer_build_chapter_schema( $post_id );
|
||||
@ -63,9 +63,9 @@ if ( ! function_exists( 'fictioneer_build_chapter_schema' ) ) {
|
||||
|
||||
// Setup
|
||||
$schema = fictioneer_get_schema_node_root();
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $post_id );
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
$image_data = fictioneer_get_schema_primary_image( $post_id );
|
||||
$word_count = intval( fictioneer_get_field( '_word_count', $post_id ) );
|
||||
$word_count = intval( get_post_meta( $post_id, '_word_count', true ) );
|
||||
$page_description = fictioneer_get_seo_description( $post_id );
|
||||
$page_title = fictioneer_get_seo_title( $post_id, array( 'skip_cache' => true ) );
|
||||
|
||||
@ -92,7 +92,7 @@ if ( ! function_exists( 'fictioneer_build_chapter_schema' ) ) {
|
||||
}
|
||||
|
||||
if ( ! empty( $story_id ) ) {
|
||||
$article_node['contentRating'] = fictioneer_get_field( 'fictioneer_story_rating', $story_id );
|
||||
$article_node['contentRating'] = get_post_meta( $story_id, 'fictioneer_story_rating', true );
|
||||
$article_node['articleSection'] = get_the_title( $story_id );
|
||||
}
|
||||
|
||||
|
@ -91,11 +91,11 @@ if ( ! function_exists( 'fictioneer_build_chapters_schema' ) ) {
|
||||
// Filter out invalid chapters (faster than meta query)
|
||||
$list = array_filter( $list, function ( $post ) {
|
||||
// Chapter hidden?
|
||||
$chapter_hidden = fictioneer_get_field( 'fictioneer_chapter_hidden', $post->ID );
|
||||
$chapter_hidden = get_post_meta( $post->ID, 'fictioneer_chapter_hidden', true );
|
||||
$not_hidden = empty( $chapter_hidden ) || $chapter_hidden === '0';
|
||||
|
||||
// Not a chapter?
|
||||
$no_chapter = fictioneer_get_field('fictioneer_chapter_no_chapter', $post->ID );
|
||||
$no_chapter = get_post_meta( $post->ID, 'fictioneer_chapter_no_chapter', true );
|
||||
$is_chapter = empty( $no_chapter ) || $no_chapter === '0';
|
||||
|
||||
// Only keep if both conditions are met
|
||||
|
@ -57,7 +57,7 @@ if ( ! function_exists( 'fictioneer_build_recommendation_schema' ) ) {
|
||||
$schema = fictioneer_get_schema_node_root();
|
||||
$image_data = fictioneer_get_schema_primary_image( $post_id );
|
||||
$page_title = fictioneer_get_seo_title( $post_id, array( 'skip_cache' => true ) );
|
||||
$default_description = fictioneer_get_field( 'fictioneer_recommendation_one_sentence', $post_id );
|
||||
$default_description = get_post_meta( $post_id, 'fictioneer_recommendation_one_sentence', true );
|
||||
|
||||
$page_description = fictioneer_get_seo_description(
|
||||
$post_id,
|
||||
@ -85,8 +85,8 @@ if ( ! function_exists( 'fictioneer_build_recommendation_schema' ) ) {
|
||||
// Override author node
|
||||
$article_node['author'] = array(
|
||||
'@type' => 'Person',
|
||||
'url' => fictioneer_get_field( 'fictioneer_recommendation_primary_url', $post_id ),
|
||||
'name' => addslashes( fictioneer_get_field( 'fictioneer_recommendation_author', $post_id ) )
|
||||
'url' => get_post_meta( $post_id, 'fictioneer_recommendation_primary_url', true ),
|
||||
'name' => addslashes( get_post_meta( $post_id, 'fictioneer_recommendation_author', true ) )
|
||||
);
|
||||
|
||||
$schema['@graph'][] = $article_node;
|
||||
|
@ -91,7 +91,8 @@ if ( ! function_exists( 'fictioneer_build_stories_schema' ) ) {
|
||||
// Filter out invalid chapters (faster than meta query)
|
||||
$list = array_filter( $list, function ( $post ) {
|
||||
// Chapter hidden?
|
||||
$story_hidden = fictioneer_get_field( 'fictioneer_story_hidden', $post->ID );
|
||||
$story_hidden = get_post_meta( $post->ID, 'fictioneer_story_hidden', true );
|
||||
|
||||
return empty( $story_hidden ) || $story_hidden === '0';
|
||||
});
|
||||
|
||||
|
@ -31,7 +31,7 @@ function fictioneer_refresh_story_schema( $post_id, $post ) {
|
||||
fictioneer_build_story_schema( $post_id );
|
||||
|
||||
// Get chapters of story
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $post_id );
|
||||
$chapters = get_post_meta( $post_id, 'fictioneer_story_chapters', true );
|
||||
|
||||
// Rebuild chapter schemas (if any)
|
||||
if ( is_array( $chapters ) ) {
|
||||
@ -66,8 +66,8 @@ if ( ! function_exists( 'fictioneer_build_story_schema' ) ) {
|
||||
// Setup
|
||||
$schema = fictioneer_get_schema_node_root();
|
||||
$image_data = fictioneer_get_schema_primary_image( $post_id );
|
||||
$rating = fictioneer_get_field( 'fictioneer_story_rating', $post_id );
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $post_id );
|
||||
$rating = get_post_meta( $post_id, 'fictioneer_story_rating', true );
|
||||
$chapters = get_post_meta( $post_id, 'fictioneer_story_chapters', true );
|
||||
$page_title = fictioneer_get_seo_title( $post_id, array( 'skip_cache' => true ) );
|
||||
$default_description = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description', $post_id ) );
|
||||
$chapter_count = 0;
|
||||
@ -82,8 +82,8 @@ if ( ! function_exists( 'fictioneer_build_story_schema' ) ) {
|
||||
if ( is_array( $chapters ) ) {
|
||||
foreach ( $chapters as $chapter_id ) {
|
||||
if (
|
||||
! fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter_id ) &&
|
||||
! fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter_id ) &&
|
||||
! get_post_meta( $chapter_id, 'fictioneer_chapter_no_chapter', true ) &&
|
||||
! get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) &&
|
||||
get_post_status( $chapter_id ) === 'publish'
|
||||
) {
|
||||
$chapter_count += 1;
|
||||
|
@ -104,7 +104,7 @@ class Fictioneer_Epubs_Table extends WP_List_Table {
|
||||
|
||||
if ( $story ) {
|
||||
$story_data = fictioneer_get_story_data( $story->ID, false );
|
||||
$download_stats = fictioneer_get_field( 'fictioneer_epub_downloads', $story->ID );
|
||||
$download_stats = get_post_meta( $story->ID, 'fictioneer_epub_downloads', true );
|
||||
$download_stats = is_array( $download_stats ) ? $download_stats : [0];
|
||||
$downloads_version = end( $download_stats );
|
||||
$downloads_total = array_sum( $download_stats );
|
||||
|
@ -76,12 +76,12 @@ class Fictioneer_Seo_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
public function column_default( $item, $column_name ) {
|
||||
$schema = fictioneer_get_field( 'fictioneer_schema', $item->ID );
|
||||
$schema = get_post_meta( $item->ID, 'fictioneer_schema', true );
|
||||
$schema_text = stripslashes( json_encode( json_decode( $schema ), JSON_PRETTY_PRINT ) );
|
||||
|
||||
switch ( $column_name ) {
|
||||
case 'title':
|
||||
$image = fictioneer_get_field( 'fictioneer_seo_og_image_cache', $item->ID );
|
||||
$image = get_post_meta( $item->ID, 'fictioneer_seo_og_image_cache', true );
|
||||
$image_url = $image ? $image['url'] : get_template_directory_uri() . '/img/no_image_placeholder.svg';
|
||||
$link = get_the_permalink( $item->ID );
|
||||
$title = mb_strimwidth( fictioneer_get_seo_title( $item->ID ), 0, 48, '…' );
|
||||
@ -131,7 +131,7 @@ class Fictioneer_Seo_Table extends WP_List_Table {
|
||||
$row_class = '';
|
||||
|
||||
// Setup
|
||||
$schema = fictioneer_get_field( 'fictioneer_schema', $item->ID );
|
||||
$schema = get_post_meta( $item->ID, 'fictioneer_schema', true );
|
||||
|
||||
// Add class or not
|
||||
if ( ! $schema ) {
|
||||
|
@ -251,7 +251,7 @@ if ( ! function_exists( 'fictioneer_query_followed_chapters' ) ) {
|
||||
// Filter out hidden chapters (faster than meta query, highly unlikely to eliminate all)
|
||||
$chapters = array_filter( $all_chapters, function ( $candidate ) {
|
||||
// Chapter hidden?
|
||||
$chapter_hidden = fictioneer_get_field( 'fictioneer_chapter_hidden', $candidate->ID );
|
||||
$chapter_hidden = get_post_meta( $candidate->ID, 'fictioneer_chapter_hidden', true );
|
||||
|
||||
// Only keep if not hidden
|
||||
return empty( $chapter_hidden ) || $chapter_hidden === '0';
|
||||
@ -324,7 +324,7 @@ function fictioneer_ajax_get_follows_notifications() {
|
||||
), $chapter->ID
|
||||
);
|
||||
$chapter_timestamp = get_post_timestamp( $chapter->ID ) * 1000; // Compatible with Date.now() in JavaScript
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', $chapter->ID );
|
||||
$story_id = get_post_meta( $chapter->ID, 'fictioneer_chapter_story', true );
|
||||
$new = $user_follows['seen'] < $chapter_timestamp ? '_new' : '';
|
||||
|
||||
// Start HTML ---> ?>
|
||||
|
@ -68,8 +68,8 @@ $hook_args = array(
|
||||
// Special conditions for chapters...
|
||||
if ( $type == 'fcn_chapter' ) {
|
||||
if (
|
||||
fictioneer_get_field( 'fictioneer_chapter_no_chapter' ) ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_hidden' )
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_no_chapter', true ) ||
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_hidden', true )
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ $pag_args = array(
|
||||
$genres = get_the_terms( $post, 'fcn_genre' );
|
||||
|
||||
// Thumbnail
|
||||
$landscape_image_id = fictioneer_get_field( 'fictioneer_landscape_image', get_the_ID() );
|
||||
$landscape_image_id = get_post_meta( get_the_ID(), 'fictioneer_landscape_image', true );
|
||||
$thumbnail = null;
|
||||
|
||||
$image_args = array(
|
||||
@ -147,7 +147,7 @@ $pag_args = array(
|
||||
|
||||
// Chapter story?
|
||||
if ( $post->post_type === 'fcn_chapter' ) {
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story' );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
}
|
||||
|
||||
// Start HTML ---> ?>
|
||||
@ -159,7 +159,7 @@ $pag_args = array(
|
||||
<?php
|
||||
// Try parent thumbnail (if any)
|
||||
if ( ! $landscape_image_id && ! $thumbnail && $story_id ) {
|
||||
$landscape_image_id = fictioneer_get_field( 'fictioneer_landscape_image', $story_id );
|
||||
$landscape_image_id = get_post_meta( $story_id, 'fictioneer_landscape_image', true );
|
||||
$thumbnail = get_the_post_thumbnail( $story_id, 'medium', $image_args );
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,12 @@ defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story' );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
$story_unpublished = get_post_status( $story_id ) !== 'publish';
|
||||
$story_data = $story_id ? fictioneer_get_story_data( $story_id, false ) : null; // Does not refresh comment count!
|
||||
$chapter_rating = fictioneer_get_field( 'fictioneer_chapter_rating' );
|
||||
$chapter_rating = get_post_meta( get_the_ID(), 'fictioneer_chapter_rating', true );
|
||||
$story_thumbnail_url_full = $story_id ? get_the_post_thumbnail_url( $story_id, 'full' ) : null;
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon' );
|
||||
$text_icon = get_post_meta( get_the_ID(), 'fictioneer_chapter_text_icon', true );
|
||||
$excerpt = fictioneer_get_forced_excerpt( $post, 512, true );
|
||||
|
||||
// Taxonomies
|
||||
@ -71,7 +71,7 @@ $show_type = $args['show_type'] ?? false;
|
||||
|
||||
<h3 class="card__title">
|
||||
<a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
$list_title = wp_strip_all_tags( fictioneer_get_field( 'fictioneer_chapter_list_title' ) );
|
||||
$list_title = wp_strip_all_tags( get_post_meta( get_the_ID(), 'fictioneer_chapter_list_title', true ) );
|
||||
$list_title = trim( $list_title );
|
||||
|
||||
// Make sure there are no whitespaces in-between!
|
||||
@ -122,7 +122,7 @@ $show_type = $args['show_type'] ?? false;
|
||||
'<a href="%1$s" title="%2$s" class="card__text-icon cell-img"><span class="text-icon">%3$s</span></a>',
|
||||
get_permalink(),
|
||||
esc_attr( $title ),
|
||||
fictioneer_get_field( 'fictioneer_chapter_text_icon' )
|
||||
get_post_meta( get_the_ID(), 'fictioneer_chapter_text_icon', true )
|
||||
);
|
||||
|
||||
}
|
||||
@ -191,7 +191,7 @@ $show_type = $args['show_type'] ?? false;
|
||||
|
||||
$footer_items['words'] = '<i class="card-footer-icon fa-solid fa-font" title="' .
|
||||
esc_attr__( 'Words', 'fictioneer' ) . '"></i> ' .
|
||||
fictioneer_shorten_number( fictioneer_get_field( '_word_count', get_the_ID() ) );
|
||||
fictioneer_shorten_number( get_post_meta( get_the_ID(), '_word_count', true ) );
|
||||
|
||||
if ( ( $args['orderby'] ?? 0 ) === 'date' ) {
|
||||
$footer_items['publish_date'] = '<i class="card-footer-icon fa-solid fa-clock" title="' .
|
||||
|
@ -19,10 +19,10 @@
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$list_title = trim( fictioneer_get_field( 'fictioneer_collection_list_title' ) );
|
||||
$list_title = trim( get_post_meta( get_the_ID(), 'fictioneer_collection_list_title', true ) );
|
||||
$title = empty( $list_title ) ? fictioneer_get_safe_title( get_the_ID() ) : $list_title;
|
||||
$description = fictioneer_get_content_field( 'fictioneer_collection_description' );
|
||||
$items = fictioneer_get_field( 'fictioneer_collection_items' );
|
||||
$description = fictioneer_get_content_field( 'fictioneer_collection_description', get_the_ID() );
|
||||
$items = get_post_meta( get_the_ID(), 'fictioneer_collection_items', true );
|
||||
$items = empty( $items ) ? [] : $items;
|
||||
$story_count = 0;
|
||||
$chapter_count = 0;
|
||||
@ -79,13 +79,13 @@ if ( ! empty( $items ) ) {
|
||||
case 'fcn_chapter':
|
||||
if ( ! in_array( $item->ID, $processed_ids ) ) {
|
||||
$chapter_count += 1;
|
||||
$word_count += (int) fictioneer_get_field( '_word_count', $item->ID );
|
||||
$word_count += (int) get_post_meta( $item->ID, '_word_count', true );
|
||||
$processed_ids[] = $item->ID;
|
||||
}
|
||||
break;
|
||||
case 'fcn_story':
|
||||
$story_count += 1;
|
||||
$chapter_ids = fictioneer_get_field( 'fictioneer_story_chapters', $item->ID );
|
||||
$chapter_ids = get_post_meta( $item->ID, 'fictioneer_story_chapters', true ) ?: [];
|
||||
|
||||
// Try to rescue an empty description by using one from a story...
|
||||
if ( empty( $description ) ) {
|
||||
@ -110,15 +110,15 @@ if ( ! empty( $items ) ) {
|
||||
if ( ! empty( $chapters ) ) {
|
||||
foreach ( $chapters as $chapter ) {
|
||||
if (
|
||||
fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter->ID ) ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID )
|
||||
get_post_meta( $chapter->ID, 'fictioneer_chapter_no_chapter', true ) ||
|
||||
get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true )
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! in_array( $chapter->ID, $processed_ids ) ) {
|
||||
$chapter_count += 1;
|
||||
$word_count += (int) fictioneer_get_field( '_word_count', $chapter->ID );
|
||||
$word_count += (int) get_post_meta( $chapter->ID, '_word_count', true );
|
||||
$processed_ids[] = $chapter->ID;
|
||||
}
|
||||
}
|
||||
@ -193,7 +193,7 @@ $comment_count = get_comments( $comment_args );
|
||||
<i class="fa-solid fa-caret-right"></i>
|
||||
<a href="<?php the_permalink( $item->ID ); ?>" class="card__link-list-link"><?php
|
||||
$list_title = $item->post_type == 'fcn_chapter' ?
|
||||
fictioneer_get_field( 'fictioneer_chapter_list_title', $item->ID ) : 0;
|
||||
get_post_meta( $item->ID, 'fictioneer_chapter_list_title', true ) : 0;
|
||||
|
||||
if ( $list_title ) {
|
||||
echo wp_strip_all_tags( $list_title );
|
||||
|
@ -21,14 +21,11 @@ defined( 'ABSPATH' ) OR exit;
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$links = array_merge(
|
||||
fictioneer_url_list_to_array( fictioneer_get_field( 'fictioneer_recommendation_urls' ) ),
|
||||
fictioneer_url_list_to_array( fictioneer_get_field( 'fictioneer_recommendation_support' ) )
|
||||
fictioneer_url_list_to_array( get_post_meta( get_the_ID(), 'fictioneer_recommendation_urls', true ) ),
|
||||
fictioneer_url_list_to_array( get_post_meta( get_the_ID(), 'fictioneer_recommendation_support', true ) )
|
||||
);
|
||||
$excerpt = get_the_excerpt();
|
||||
$one_sentence = fictioneer_get_field( 'fictioneer_recommendation_one_sentence' ) ?? '';
|
||||
|
||||
// Sanitize
|
||||
// $urls = array_map( 'wp_strip_all_tags', $urls );
|
||||
$one_sentence = get_post_meta( get_the_ID(), 'fictioneer_recommendation_one_sentence', true );
|
||||
|
||||
// Taxonomies
|
||||
$tags = false;
|
||||
@ -84,7 +81,7 @@ $show_type = $args['show_type'] ?? false;
|
||||
'<div class="card__content cell-desc truncate _4-4"><span class="card__by-author">%1$s</span> <span>%2$s</span></div>',
|
||||
sprintf(
|
||||
_x( 'by %s —', 'Large card: by {Author} —.', 'fictioneer' ),
|
||||
fictioneer_get_field( 'fictioneer_recommendation_author' )
|
||||
get_post_meta( get_the_ID(), 'fictioneer_recommendation_author', true )
|
||||
),
|
||||
strlen( $one_sentence ) < strlen( $excerpt ) ? $excerpt : wp_strip_all_tags( $one_sentence, true )
|
||||
);
|
||||
|
@ -25,7 +25,9 @@ $story = fictioneer_get_story_data( $post->ID );
|
||||
$latest = $args['show_latest'] ?? false;
|
||||
$chapter_ids = array_slice( $story['chapter_ids'], $latest ? -3 : 0, 3, true ); // Does not include hidden or non-chapters
|
||||
$chapter_count = count( $chapter_ids );
|
||||
$excerpt = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description' ) );
|
||||
$excerpt = fictioneer_first_paragraph_as_excerpt(
|
||||
fictioneer_get_content_field( 'fictioneer_story_short_description', $post->ID )
|
||||
);
|
||||
$excerpt = empty( $excerpt ) ? __( 'No description provided yet.', 'fictioneer' ) : $excerpt;
|
||||
$tags = false;
|
||||
|
||||
@ -41,7 +43,7 @@ $hide_author = $args['hide_author'] ?? false && ! get_option( 'fictioneer_show_a
|
||||
$show_taxonomies = ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) && ( $story['has_taxonomies'] || $tags );
|
||||
$show_type = $args['show_type'] ?? false;
|
||||
$is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
|
||||
fictioneer_get_field( 'fictioneer_story_sticky' ) && ! is_search() && ! is_archive();
|
||||
get_post_meta( $post->ID, 'fictioneer_story_sticky', true ) && ! is_search() && ! is_archive();
|
||||
|
||||
?>
|
||||
|
||||
@ -119,7 +121,7 @@ $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
|
||||
<div class="card__left text-overflow-ellipsis">
|
||||
<i class="fa-solid fa-caret-right"></i>
|
||||
<a href="<?php the_permalink( $chapter->ID ); ?>" class="card__link-list-link"><?php
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $chapter->ID );
|
||||
$list_title = get_post_meta( $chapter->ID, 'fictioneer_chapter_list_title', true );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
@ -133,7 +135,7 @@ $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
|
||||
<?php
|
||||
printf(
|
||||
'%1$s<span class="hide-below-480"> %2$s</span><span class="separator-dot"> • </span>%3$s',
|
||||
fictioneer_shorten_number( fictioneer_get_field( '_word_count', $chapter->ID ) ),
|
||||
fictioneer_shorten_number( get_post_meta( $chapter->ID, '_word_count', true ) ),
|
||||
__( 'Words', 'fictioneer' ),
|
||||
strtotime( '-1 days' ) < strtotime( get_the_date( '', $chapter->ID ) ) ?
|
||||
__( 'New', 'fictioneer' ) : get_the_time( FICTIONEER_CARD_STORY_LI_DATE, $chapter->ID )
|
||||
|
@ -35,7 +35,7 @@ $story_visible = $args['story_post'] &&
|
||||
<a href="<?php the_permalink( $args['story_post']->ID ); ?>"><?php echo $args['story_data']['title']; ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! fictioneer_get_field( 'fictioneer_chapter_hide_title' ) ) : ?>
|
||||
<?php if ( ! get_post_meta( get_the_ID(), 'fictioneer_chapter_hide_title', true ) ) : ?>
|
||||
<h1 class="chapter__title<?php if ( ! empty( $args['chapter_password'] ) ) echo ' password'; ?>"><?php echo $args['chapter_title']; ?></h1>
|
||||
<em class="chapter__author"><?php
|
||||
printf(
|
||||
|
@ -69,10 +69,10 @@ if ( ! empty( $args['featured_list'] ) ) {
|
||||
foreach ( $chapters->posts as $chapter ) {
|
||||
// This is about 50 times faster than using a meta query lol
|
||||
if (
|
||||
! fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter->ID ) &&
|
||||
! fictioneer_get_field( 'fictioneer_chapter_no_chapter', $chapter->ID )
|
||||
! get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true ) &&
|
||||
! get_post_meta( $chapter->ID, 'fictioneer_chapter_no_chapter', true )
|
||||
) {
|
||||
$word_count += (int) fictioneer_get_field( '_word_count', $chapter->ID );
|
||||
$word_count += (int) get_post_meta( $chapter->ID, '_word_count', true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story' );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( get_post_status( $story_id ) !== 'publish' ) {
|
||||
continue;
|
||||
@ -121,7 +121,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : false; // Does not refresh comment count!
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon' );
|
||||
$text_icon = get_post_meta( get_the_ID(), 'fictioneer_chapter_text_icon', true );
|
||||
|
||||
// Chapter images
|
||||
$thumbnail_full = get_the_post_thumbnail_url( $post, 'full' );
|
||||
@ -153,7 +153,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
$list_title = get_post_meta( get_the_ID(), 'fictioneer_chapter_list_title', true );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
echo $list_title ? $list_title : $title;
|
||||
@ -180,7 +180,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php
|
||||
printf(
|
||||
_x( '%1$s Words on %2$s', 'Small card: {n} Words on {Date}.', 'fictioneer' ),
|
||||
fictioneer_shorten_number( fictioneer_get_field( '_word_count', $post->ID ) ),
|
||||
fictioneer_shorten_number( get_post_meta( $post->ID, '_word_count', true ) ),
|
||||
get_the_time( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE )
|
||||
);
|
||||
?>
|
||||
|
@ -114,16 +114,16 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story' );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( get_post_status( $story_id ) !== 'publish' ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$chapter_rating = fictioneer_get_field( 'fictioneer_chapter_rating' );
|
||||
$chapter_rating = get_post_meta( get_the_ID(), 'fictioneer_chapter_rating', true );
|
||||
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : false; // Does not refresh comment count!
|
||||
$text_icon = fictioneer_get_field( 'fictioneer_chapter_text_icon' );
|
||||
$text_icon = get_post_meta( get_the_ID(), 'fictioneer_chapter_text_icon', true );
|
||||
|
||||
// Chapter images
|
||||
$thumbnail_full = get_the_post_thumbnail_url( $post, 'full' );
|
||||
@ -153,7 +153,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 class="card__title _small cell-title"><a href="<?php the_permalink(); ?>" class="truncate _1-1"><?php
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
$list_title = get_post_meta( get_the_ID(), 'fictioneer_chapter_list_title', true );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
echo $list_title ? $list_title : $title;
|
||||
@ -204,7 +204,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
$footer_items['words'] = '<i class="card-footer-icon fa-solid fa-font" title="' .
|
||||
esc_attr__( 'Words', 'fictioneer' ) . '"></i> ' .
|
||||
fictioneer_shorten_number( fictioneer_get_field( '_word_count', $post->ID ) );
|
||||
fictioneer_shorten_number( get_post_meta( $post->ID, '_word_count', true ) );
|
||||
|
||||
if ( $args['orderby'] == 'modified' ) {
|
||||
$footer_items['modified_date'] = '<i class="card-footer-icon fa-regular fa-clock" title="' .
|
||||
|
@ -99,7 +99,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$one_sentence = fictioneer_get_field( 'fictioneer_recommendation_one_sentence' );
|
||||
$one_sentence = get_post_meta( get_the_ID(), 'fictioneer_recommendation_one_sentence', true );
|
||||
$fandoms = get_the_terms( $post, 'fcn_fandom' );
|
||||
$characters = get_the_terms( $post, 'fcn_character' );
|
||||
$genres = get_the_terms( $post, 'fcn_genre' );
|
||||
@ -127,7 +127,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<span class="card__by-author"><?php
|
||||
printf(
|
||||
_x( 'by %s —', 'Small card: by {Author} —.', 'fictioneer' ),
|
||||
'<span class="author">' . fictioneer_get_field( 'fictioneer_recommendation_author' ) . '</span>'
|
||||
'<span class="author">' . get_post_meta( get_the_ID(), 'fictioneer_recommendation_author', true ) . '</span>'
|
||||
);
|
||||
?></span>
|
||||
<span><?php
|
||||
|
@ -100,7 +100,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$one_sentence = fictioneer_get_field( 'fictioneer_recommendation_one_sentence' );
|
||||
$one_sentence = get_post_meta( get_the_ID(), 'fictioneer_recommendation_one_sentence', true );
|
||||
$fandoms = get_the_terms( $post, 'fcn_fandom' );
|
||||
$characters = get_the_terms( $post, 'fcn_character' );
|
||||
$genres = get_the_terms( $post, 'fcn_genre' );
|
||||
@ -108,8 +108,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
// Sources
|
||||
$urls = array_merge(
|
||||
explode( "\n", fictioneer_get_field( 'fictioneer_recommendation_urls' ) ),
|
||||
explode( "\n", fictioneer_get_field( 'fictioneer_recommendation_support' ) )
|
||||
explode( "\n", get_post_meta( get_the_ID(), 'fictioneer_recommendation_urls', true ) ),
|
||||
explode( "\n", get_post_meta( get_the_ID(), 'fictioneer_recommendation_support', true ) )
|
||||
);
|
||||
|
||||
// Sanitize
|
||||
@ -146,7 +146,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<span class="card__by-author"><?php
|
||||
printf(
|
||||
_x( 'by %s on', 'Small card: by {Author} on.', 'fictioneer' ),
|
||||
'<span class="author">' . fictioneer_get_field( 'fictioneer_recommendation_author' ) . '</span>'
|
||||
'<span class="author">' . get_post_meta( get_the_ID(), 'fictioneer_recommendation_author', true ) . '</span>'
|
||||
);
|
||||
?></span>
|
||||
<a href="<?php echo esc_url( $tuple[1] ); ?>" rel="noopener" target="_blank" class="bold-link"><?php
|
||||
|
@ -138,7 +138,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
?></span>
|
||||
<?php endif; ?>
|
||||
<span><?php
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description' ) );
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt(
|
||||
fictioneer_get_content_field( 'fictioneer_story_short_description', get_the_ID() )
|
||||
);
|
||||
echo strlen( $short_description ) < 230 ? get_the_excerpt() : $short_description;
|
||||
?></span>
|
||||
</div>
|
||||
|
@ -131,7 +131,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
?></span>
|
||||
<?php endif; ?>
|
||||
<span><?php
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description' ) );
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt(
|
||||
fictioneer_get_content_field( 'fictioneer_story_short_description', get_the_ID() )
|
||||
);
|
||||
echo strlen( $short_description ) < 230 ? get_the_excerpt() : $short_description;
|
||||
?></span>
|
||||
</div>
|
||||
|
@ -127,7 +127,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$search_list = array_reverse( $story['chapter_ids'] );
|
||||
|
||||
foreach ( $search_list as $chapter_id ) {
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter_id ) ) {
|
||||
if ( get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -166,7 +166,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
?></span>
|
||||
<?php endif; ?>
|
||||
<span><?php
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description' ) );
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt(
|
||||
fictioneer_get_content_field( 'fictioneer_story_short_description', get_the_ID() )
|
||||
);
|
||||
echo strlen( $short_description ) < 230 ? get_the_excerpt() : $short_description;
|
||||
?></span>
|
||||
</div>
|
||||
@ -175,7 +177,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php foreach ( $chapter_list as $chapter_id ) : ?>
|
||||
<?php
|
||||
// Chapter title
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $chapter_id );
|
||||
$list_title = get_post_meta( $chapter_id, 'fictioneer_chapter_list_title', true );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
@ -196,7 +198,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
<div class="card__right">
|
||||
<?php
|
||||
echo fictioneer_shorten_number( fictioneer_get_field( '_word_count', $chapter_id ) );
|
||||
echo fictioneer_shorten_number( get_post_meta( $chapter_id, '_word_count', true ) );
|
||||
echo '<span class="separator-dot"> • </span>';
|
||||
echo get_the_date( FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter_id )
|
||||
?>
|
||||
|
@ -127,7 +127,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$search_list = array_reverse( $story['chapter_ids'] );
|
||||
|
||||
foreach ( $search_list as $chapter_id ) {
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden', $chapter_id ) ) {
|
||||
if ( get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -168,7 +168,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
?></span>
|
||||
<?php endif; ?>
|
||||
<span><?php
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt( fictioneer_get_content_field( 'fictioneer_story_short_description' ) );
|
||||
$short_description = fictioneer_first_paragraph_as_excerpt(
|
||||
fictioneer_get_content_field( 'fictioneer_story_short_description', get_the_ID() )
|
||||
);
|
||||
echo strlen( $short_description ) < 230 ? get_the_excerpt() : $short_description;
|
||||
?></span>
|
||||
</div>
|
||||
@ -181,7 +183,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<i class="fa-solid fa-caret-right"></i>
|
||||
<a href="<?php the_permalink( $chapter_id ); ?>" class="card__link-list-link"><?php
|
||||
// Chapter title
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title', $chapter_id );
|
||||
$list_title = get_post_meta( $chapter_id, 'fictioneer_chapter_list_title', true );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
@ -193,7 +195,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
<div class="card__right">
|
||||
<?php
|
||||
echo fictioneer_shorten_number( fictioneer_get_field( '_word_count', $chapter_id ) );
|
||||
echo fictioneer_shorten_number( get_post_meta( $chapter_id, '_word_count', true ) );
|
||||
echo '<span class="separator-dot"> • </span>';
|
||||
echo get_the_date( FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter_id )
|
||||
?>
|
||||
|
@ -20,7 +20,7 @@ defined( 'ABSPATH' ) OR exit;
|
||||
// Setup
|
||||
$feed = fictioneer_get_rss_link();
|
||||
$show_feed = get_post_type() !== 'fcn_story' ||
|
||||
( get_post_type() === 'fcn_story' && fictioneer_get_field( 'fictioneer_story_status', get_the_ID() ) !== 'Oneshot' )
|
||||
( get_post_type() === 'fcn_story' && get_post_meta( get_the_ID(), 'fictioneer_story_status', true ) !== 'Oneshot' )
|
||||
|
||||
?>
|
||||
|
||||
@ -36,7 +36,7 @@ $show_feed = get_post_type() !== 'fcn_story' ||
|
||||
|
||||
<?php $feed_url = urlencode( $feed ); ?>
|
||||
|
||||
<?php if ( get_post_type() === 'fcn_story' && ! fictioneer_get_field( 'fictioneer_story_hidden', get_the_ID() ) ) : ?>
|
||||
<?php if ( get_post_type() === 'fcn_story' && ! get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) : ?>
|
||||
<a
|
||||
href="<?php echo $feed; ?>"
|
||||
class="rss-link tooltipped media-buttons__item"
|
||||
|
@ -103,20 +103,21 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
// Setup
|
||||
$list_title = '';
|
||||
$story_id = null;
|
||||
$landscape_image_id = fictioneer_get_field( 'fictioneer_landscape_image', get_the_ID() );
|
||||
$landscape_image_id = get_post_meta( get_the_ID(), 'fictioneer_landscape_image', true );
|
||||
|
||||
// Get list title and story ID (if any)
|
||||
switch ( $args['post_type'] ) {
|
||||
case 'fcn_collection':
|
||||
$list_title = fictioneer_get_field( 'fictioneer_collection_list_title' );
|
||||
$list_title = get_post_meta( get_the_ID(), 'fictioneer_collection_list_title', true );
|
||||
break;
|
||||
case 'fcn_chapter':
|
||||
$list_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', get_the_ID() );
|
||||
$list_title = get_post_meta( get_the_ID(), 'fictioneer_chapter_list_title', true );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
|
||||
if ( empty( $landscape_image_id ) ) {
|
||||
$landscape_image_id = fictioneer_get_field( 'fictioneer_landscape_image', $story_id );
|
||||
$landscape_image_id = get_post_meta( $story_id, 'fictioneer_landscape_image', true );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -23,14 +23,14 @@ defined( 'ABSPATH' ) OR exit;
|
||||
// Setup
|
||||
$story_id = $args['story_id'];
|
||||
$story = $args['story_data'];
|
||||
$custom_pages = fictioneer_get_field( 'fictioneer_story_custom_pages' );
|
||||
$custom_pages = get_post_meta( $story_id, 'fictioneer_story_custom_pages', true );
|
||||
$tab_pages = [];
|
||||
$blog_posts = fictioneer_get_story_blog_posts( $story_id );
|
||||
|
||||
if ( $custom_pages ) {
|
||||
if ( is_array( $custom_pages ) ) {
|
||||
foreach ( $custom_pages as $page_id ) {
|
||||
if ( get_post_status( $page_id ) === 'publish' ) {
|
||||
$tab_pages[] = [$page_id, fictioneer_get_field( 'fictioneer_short_name', $page_id ), get_the_content( null, false, $page_id )];
|
||||
$tab_pages[] = [$page_id, get_post_meta( $page_id, 'fictioneer_short_name', true ), get_the_content( null, false, $page_id )];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,9 +39,11 @@ if ( $custom_pages ) {
|
||||
$chapters_html = FICTIONEER_CHAPTER_LIST_TRANSIENTS ? get_transient( 'fictioneer_story_chapter_list_' . $story_id ) : null;
|
||||
|
||||
// Flags
|
||||
$hide_icons = fictioneer_get_field( 'fictioneer_story_hide_chapter_icons' ) || get_option( 'fictioneer_hide_chapter_icons' );
|
||||
$enable_groups = get_option( 'fictioneer_enable_chapter_groups' ) && ! fictioneer_get_field( 'fictioneer_story_disable_groups' );
|
||||
$disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
$hide_icons = get_post_meta( $story_id, 'fictioneer_story_hide_chapter_icons', true ) ||
|
||||
get_option( 'fictioneer_hide_chapter_icons' );
|
||||
$enable_groups = get_option( 'fictioneer_enable_chapter_groups' ) &&
|
||||
! get_post_meta( $story_id, 'fictioneer_story_disable_groups', true );
|
||||
$disable_folding = get_post_meta( $story_id, 'fictioneer_story_disable_collapse', true );
|
||||
|
||||
?>
|
||||
|
||||
@ -148,7 +150,7 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
|
||||
<section id="chapters" class="story__tab-page _current story__chapters" data-order="asc" data-view="list">
|
||||
<?php
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id ); // Already prepared!
|
||||
$chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true ) ?: []; // Already prepared!
|
||||
$chapter_groups = [];
|
||||
|
||||
// Loop and prepare groups
|
||||
@ -175,12 +177,12 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
$chapter_id = get_the_ID();
|
||||
|
||||
// Skip not visible chapters (redundant for paranoia)
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) {
|
||||
if ( get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Data
|
||||
$group = fictioneer_get_field( 'fictioneer_chapter_group' );
|
||||
$group = get_post_meta( $chapter_id, 'fictioneer_chapter_group', true );
|
||||
$group = empty( $group ) ? fcntr( 'unassigned_group' ) : $group;
|
||||
$group = $enable_groups ? $group : 'all_chapters';
|
||||
$group_key = sanitize_title( $group );
|
||||
@ -193,19 +195,19 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
}
|
||||
|
||||
$chapter_groups[sanitize_title( $group )]['data'][] = array(
|
||||
'id' => get_the_ID(),
|
||||
'id' => $chapter_id,
|
||||
'link' => get_permalink(),
|
||||
'timestamp' => get_the_time( 'c' ),
|
||||
'password' => ! empty( $post->post_password ),
|
||||
'list_date' => get_the_date( '', $post ),
|
||||
'grid_date' => get_the_time( get_option( 'fictioneer_subitem_date_format', "M j, 'y" ) ?: "M j, 'y" ),
|
||||
'icon' => fictioneer_get_icon_field( 'fictioneer_chapter_icon' ),
|
||||
'text_icon' => fictioneer_get_field( 'fictioneer_chapter_text_icon' ),
|
||||
'prefix' => fictioneer_get_field( 'fictioneer_chapter_prefix' ),
|
||||
'icon' => fictioneer_get_icon_field( 'fictioneer_chapter_icon', $chapter_id ),
|
||||
'text_icon' => get_post_meta( $chapter_id, 'fictioneer_chapter_text_icon', true ),
|
||||
'prefix' => get_post_meta( $chapter_id, 'fictioneer_chapter_prefix', true ),
|
||||
'title' => fictioneer_get_safe_title( $chapter_id ),
|
||||
'list_title' => fictioneer_get_field( 'fictioneer_chapter_list_title' ),
|
||||
'words' => fictioneer_get_field( '_word_count', $chapter_id ),
|
||||
'warning' => fictioneer_get_field( 'fictioneer_chapter_warning' )
|
||||
'list_title' => get_post_meta( $chapter_id, 'fictioneer_chapter_list_title', true ),
|
||||
'words' => get_post_meta( $chapter_id, '_word_count', true ),
|
||||
'warning' => get_post_meta( $chapter_id, 'fictioneer_chapter_warning', true )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,18 @@ defined( 'ABSPATH' ) OR exit;
|
||||
// Setup
|
||||
$story = $args['story_data'];
|
||||
$story_id = $args['story_id'];
|
||||
$tax_shown = ! get_option( 'fictioneer_hide_taxonomies_on_pages' ) && $story['has_taxonomies'] && ! fictioneer_get_field( 'fictioneer_story_no_tags' );
|
||||
$thumbnail_shown = has_post_thumbnail() && ! fictioneer_get_field( 'fictioneer_story_no_thumbnail' );
|
||||
$thumbnail_shown = has_post_thumbnail() && ! get_post_meta( $story_id, 'fictioneer_story_no_thumbnail', true );
|
||||
$tax_shown = ! get_option( 'fictioneer_hide_taxonomies_on_pages' ) &&
|
||||
$story['has_taxonomies'] &&
|
||||
! get_post_meta( $story_id, 'fictioneer_story_no_tags', true );
|
||||
|
||||
// Story header classes
|
||||
$header_classes = [];
|
||||
if ( ! $tax_shown ) $header_classes[] = '_no-tax';
|
||||
|
||||
if ( ! $tax_shown ) {
|
||||
$header_classes[] = '_no-tax';
|
||||
}
|
||||
|
||||
if ( ! $thumbnail_shown ) {
|
||||
$header_classes[] = '_no-thumbnail';
|
||||
$header_classes[] = 'padding-top';
|
||||
|
@ -27,14 +27,14 @@ $posts = get_posts(
|
||||
$posts = array_filter( $posts, function ( $post ) {
|
||||
// Chapter hidden?
|
||||
if ( $post->post_type === 'fcn_chapter' ) {
|
||||
$chapter_hidden = fictioneer_get_field( 'fictioneer_chapter_hidden', $post->ID );
|
||||
$chapter_hidden = get_post_meta( $post->ID, 'fictioneer_chapter_hidden', true );
|
||||
|
||||
return empty( $chapter_hidden ) || $chapter_hidden === '0';
|
||||
}
|
||||
|
||||
// Story hidden?
|
||||
if ( $post->post_type === 'fcn_story' ) {
|
||||
$story_hidden = fictioneer_get_field( 'fictioneer_story_hidden', $post->ID );
|
||||
$story_hidden = get_post_meta( $post->ID, 'fictioneer_story_hidden', true );
|
||||
|
||||
return empty( $story_hidden ) || $story_hidden === '0';
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
// Get ID from parameter
|
||||
$story_id = fictioneer_validate_id( $_GET[ 'story_id' ] ?? 0, 'fcn_story' );
|
||||
$is_hidden = fictioneer_get_field( 'fictioneer_story_hidden', $story_id ?: 0 ) ?: 0;
|
||||
$is_hidden = get_post_meta( $story_id ?: 0, 'fictioneer_story_hidden', true );
|
||||
|
||||
// Abort if not a valid story ID or password protected
|
||||
if ( ! $story_id || $is_hidden || post_password_required( $story_id ) ) {
|
||||
@ -25,7 +25,8 @@ if ( ! $story_id || $is_hidden || post_password_required( $story_id ) ) {
|
||||
|
||||
// Get story data
|
||||
$story = fictioneer_get_story_data( $story_id, false ); // Does not refresh comment count!
|
||||
$chapters = fictioneer_get_field( 'fictioneer_story_chapters', $story_id );
|
||||
$chapters = get_post_meta( $story_id, 'fictioneer_story_chapters', true );
|
||||
$chapters = is_array( $chapters ) ? $chapters : [];
|
||||
|
||||
// Feed title
|
||||
$title = sprintf(
|
||||
@ -154,7 +155,7 @@ do_action( 'rss_tag_pre', 'rss2' );
|
||||
}
|
||||
|
||||
// Skip invisible chapters
|
||||
if ( fictioneer_get_field( 'fictioneer_chapter_hidden' ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,11 @@
|
||||
<?php
|
||||
|
||||
// Header
|
||||
$is_hidden = fictioneer_get_field( 'fictioneer_chapter_hidden', get_queried_object_id() ) ?: 0;
|
||||
$header_args = array(
|
||||
'type' => 'fcn_chapter'
|
||||
);
|
||||
|
||||
if ( ! empty( $is_hidden ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_chapter_hidden', true ) ) {
|
||||
$header_args['no_index'] = true;
|
||||
}
|
||||
|
||||
@ -47,7 +46,7 @@ get_header( null, $header_args );
|
||||
$title = fictioneer_get_safe_title( get_the_ID() );
|
||||
$this_breadcrumb = [$title, get_the_permalink()];
|
||||
|
||||
$story_id = fictioneer_get_field( 'fictioneer_chapter_story', get_queried_object_id() );
|
||||
$story_id = get_post_meta( get_the_ID(), 'fictioneer_chapter_story', true );
|
||||
$story_data = null;
|
||||
$story_post = null;
|
||||
|
||||
@ -91,7 +90,7 @@ get_header( null, $header_args );
|
||||
if ( get_option( 'fictioneer_enable_bookmarks' ) ) {
|
||||
// Bookmark data
|
||||
$bookmark_story_title = '';
|
||||
$bookmark_title = fictioneer_get_field( 'fictioneer_chapter_list_title' );
|
||||
$bookmark_title = get_post_meta( get_the_ID(), 'fictioneer_chapter_list_title', true );
|
||||
$bookmark_title = trim( wp_strip_all_tags( $bookmark_title ) );
|
||||
$bookmark_title = $bookmark_title ?: $title;
|
||||
$bookmark_thumbnail = get_the_post_thumbnail_url( null, 'snippet' );
|
||||
@ -146,7 +145,7 @@ get_header( null, $header_args );
|
||||
do_action( 'fictioneer_chapter_after_header', $hook_args );
|
||||
|
||||
// Password note
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_chapter_password_note' );
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_chapter_password_note', get_the_ID() );
|
||||
?>
|
||||
|
||||
<section id="chapter-content" class="chapter__content content-section">
|
||||
|
@ -33,8 +33,8 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$featured_list = fictioneer_get_field( 'fictioneer_collection_items' );
|
||||
$featured_list = empty( $featured_list ) ? [] : $featured_list;
|
||||
$featured_list = get_post_meta( get_the_ID(), 'fictioneer_collection_items', true );
|
||||
$featured_list = is_array( $featured_list ) ? $featured_list : [];
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$this_breadcrumb = [$title, get_the_permalink()];
|
||||
$current_page = max( 1, get_query_var( 'pg', 1 ) ?: 1 ); // Paged not available
|
||||
@ -57,8 +57,8 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
|
||||
|
||||
foreach ( $raw_query->posts as $raw_post ) {
|
||||
if (
|
||||
fictioneer_get_field( 'fictioneer_story_hidden', $raw_post->ID ) ||
|
||||
fictioneer_get_field( 'fictioneer_chapter_hidden', $raw_post->ID )
|
||||
get_post_meta( $raw_post->ID, 'fictioneer_story_hidden', true ) ||
|
||||
get_post_meta( $raw_post->ID, 'fictioneer_chapter_hidden', true )
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
@ -15,12 +15,11 @@
|
||||
<?php
|
||||
|
||||
// Header
|
||||
$is_hidden = fictioneer_get_field( 'fictioneer_story_hidden', get_the_ID() ) ?: 0;
|
||||
$header_args = array(
|
||||
'type' => 'fcn_story'
|
||||
);
|
||||
|
||||
if ( ! empty( $is_hidden ) ) {
|
||||
if ( get_post_meta( get_the_ID(), 'fictioneer_story_hidden', true ) ) {
|
||||
$header_args['no_index'] = true;
|
||||
}
|
||||
|
||||
@ -43,7 +42,7 @@ get_header( null, $header_args );
|
||||
$story = fictioneer_get_story_data( $post->ID );
|
||||
$epub_name = sanitize_file_name( strtolower( get_the_title() ) );
|
||||
$this_breadcrumb = [$story['title'], get_the_permalink()];
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_story_password_note' );
|
||||
$password_note = fictioneer_get_content_field( 'fictioneer_story_password_note', $post->ID );
|
||||
|
||||
// Flags
|
||||
$can_checkmarks = get_option( 'fictioneer_enable_checkmarks' );
|
||||
|
Loading…
x
Reference in New Issue
Block a user