Reduce database calls, add option to skip them

Apparently, get_bloginfo() is not cached, so calling it over and over again negatively impacts performance. Child themes can now make use of four new constants to skip these calls entirely.
This commit is contained in:
Tetrakern 2023-05-11 11:37:40 +02:00
parent 84584a0c0e
commit 69669ea92d
19 changed files with 75 additions and 43 deletions

View File

@ -50,6 +50,26 @@ if ( ! defined( 'FICTIONEER_PRIMARY_FONT_NAME' ) ) {
define( 'FICTIONEER_PRIMARY_FONT_NAME', 'Open Sans' ); define( 'FICTIONEER_PRIMARY_FONT_NAME', 'Open Sans' );
} }
// String: Meta charset attribute (skip database call if truthy for better performance)
if ( ! defined( 'FICTIONEER_SITE_CHARSET' ) ) {
define( 'FICTIONEER_SITE_CHARSET', false );
}
// String: Lang attribute (skip database call if truthy for better performance)
if ( ! defined( 'FICTIONEER_SITE_LANGUAGE' ) ) {
define( 'FICTIONEER_SITE_LANGUAGE', false );
}
// String: Site name (skip database call if truthy for better performance)
if ( ! defined( 'FICTIONEER_SITE_NAME' ) ) {
define( 'FICTIONEER_SITE_NAME', false );
}
// String: Site description (skip database call if truthy for better performance)
if ( ! defined( 'FICTIONEER_SITE_DESCRIPTION' ) ) {
define( 'FICTIONEER_SITE_DESCRIPTION', false );
}
/* /*
* Integers * Integers
*/ */

View File

@ -34,7 +34,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
$node['id'] = $story_id; $node['id'] = $story_id;
$node['guid'] = get_the_guid( $story_id ); $node['guid'] = get_the_guid( $story_id );
$node['url'] = get_permalink( $story_id ); $node['url'] = get_permalink( $story_id );
$node['language'] = empty( $language ) ? get_bloginfo( 'language' ) : $language; $node['language'] = empty( $language ) ? ( FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' ) ) : $language;
$node['title'] = $data['title']; $node['title'] = $data['title'];
// Author // Author
@ -144,7 +144,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
$chapter['id'] = $chapter_id; $chapter['id'] = $chapter_id;
$chapter['guid'] = get_the_guid( $chapter_id ); $chapter['guid'] = get_the_guid( $chapter_id );
$chapter['url'] = get_permalink(); $chapter['url'] = get_permalink();
$chapter['language'] = empty( $language ) ? get_bloginfo( 'language' ) : $language; $chapter['language'] = empty( $language ) ? ( FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' ) ) : $language;
if ( ! empty( $prefix ) ) $chapter['prefix'] = $prefix; if ( ! empty( $prefix ) ) $chapter['prefix'] = $prefix;
$chapter['title'] = fictioneer_get_safe_title( $chapter_id ); $chapter['title'] = fictioneer_get_safe_title( $chapter_id );
if ( ! empty( $group ) ) $chapter['group'] = $group; if ( ! empty( $group ) ) $chapter['group'] = $group;
@ -363,7 +363,7 @@ if ( ! function_exists( 'fictioneer_api_request_stories' ) ) {
// Site meta // Site meta
$graph['url'] = get_home_url( null, '', 'rest' ); $graph['url'] = get_home_url( null, '', 'rest' );
$graph['language'] = get_bloginfo( 'language' ); $graph['language'] = FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' );
$graph['storyCount'] = $query->found_posts; $graph['storyCount'] = $query->found_posts;
$graph['chapterCount'] = intval( wp_count_posts( 'fcn_chapter' )->publish ); $graph['chapterCount'] = intval( wp_count_posts( 'fcn_chapter' )->publish );

View File

@ -317,7 +317,7 @@ if ( ! function_exists( 'fictioneer_get_footer_copyright_note' ) ) {
ob_start(); ob_start();
// Start HTML ---> ?> // Start HTML ---> ?>
<span>© <?php echo date( 'Y' ); ?></span> <span>© <?php echo date( 'Y' ); ?></span>
<span><?php echo get_bloginfo( 'name' ); ?></span> <span><?php echo FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ); ?></span>
<span>|</span> <span>|</span>
<a href="https://github.com/Tetrakern/fictioneer" target="_blank" rel="noreferrer"><?php echo fictioneer_get_version(); ?></a> <a href="https://github.com/Tetrakern/fictioneer" target="_blank" rel="noreferrer"><?php echo fictioneer_get_version(); ?></a>
<?php // <--- End HTML <?php // <--- End HTML

View File

@ -194,7 +194,7 @@ if ( ! function_exists( 'fictioneer_ajax_submit_contact_form' ) ) {
// Headers // Headers
if ( ! empty( $from_address ) ) { if ( ! empty( $from_address ) ) {
$from_name = get_option( 'fictioneer_system_email_name' ); $from_name = get_option( 'fictioneer_system_email_name' );
$from_name = empty ( $from_name ) ? get_bloginfo( 'name' ) : $from_name; $from_name = empty ( $from_name ) ? ( FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ) ) : $from_name;
$headers[] = 'From: ' . trim( $from_name ) . ' <' . trim( $from_address ) . '>'; $headers[] = 'From: ' . trim( $from_name ) . ' <' . trim( $from_address ) . '>';
} }

View File

@ -90,10 +90,10 @@ if ( ! function_exists( 'fictioneer_get_schema_node_website' ) ) {
return array( return array(
'@type' => 'WebSite', '@type' => 'WebSite',
'@id' => "#website", '@id' => "#website",
'name' => get_bloginfo( 'name' ), 'name' => FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ),
'description' => empty( $description ) ? get_bloginfo( 'description' ) : $description, 'description' => empty( $description ) ? ( FICTIONEER_SITE_DESCRIPTION ?: get_bloginfo( 'description' ) ) : $description,
'url' => get_site_url( null, '', 'https' ), 'url' => get_site_url( null, '', 'https' ),
'inLanguage' => get_bloginfo( 'language' ) 'inLanguage' => FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' )
); );
} }
} }
@ -121,7 +121,7 @@ if ( ! function_exists( 'fictioneer_get_schema_node_image' ) ) {
return array( return array(
'@type' => 'ImageObject', '@type' => 'ImageObject',
'@id' => "#primaryimage", '@id' => "#primaryimage",
'inLanguage' => get_bloginfo( 'language' ), 'inLanguage' => FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' ),
'url' => $image_data[0], 'url' => $image_data[0],
'contentUrl' => $image_data[0], 'contentUrl' => $image_data[0],
'height' => $image_data[2], 'height' => $image_data[2],
@ -161,7 +161,7 @@ if ( ! function_exists( 'fictioneer_get_schema_node_webpage' ) ) {
'description' => $description, 'description' => $description,
'url' => get_the_permalink( $post_id ), 'url' => get_the_permalink( $post_id ),
'isPartOf' => array( '@id' => "#website" ), 'isPartOf' => array( '@id' => "#website" ),
'inLanguage' => get_bloginfo( 'language' ), 'inLanguage' => FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' ),
'datePublished' => get_the_date( 'c', $post_id ), 'datePublished' => get_the_date( 'c', $post_id ),
'dateModified' => get_the_modified_date( 'c', $post_id ) 'dateModified' => get_the_modified_date( 'c', $post_id )
); );
@ -226,7 +226,7 @@ if ( ! function_exists( 'fictioneer_get_schema_node_article' ) ) {
), ),
'isPartOf' => array( '@id' => "#webpage" ), 'isPartOf' => array( '@id' => "#webpage" ),
'mainEntityOfPage' => array( '@id' => "#webpage" ), 'mainEntityOfPage' => array( '@id' => "#webpage" ),
'inLanguage' => get_bloginfo( 'language' ), 'inLanguage' => FICTIONEER_SITE_LANGUAGE ?: get_bloginfo( 'language' ),
'datePublished' => get_the_date( 'c', $post->ID ), 'datePublished' => get_the_date( 'c', $post->ID ),
'dateModified' => get_the_modified_date( 'c', $post->ID ) 'dateModified' => get_the_modified_date( 'c', $post->ID )
); );

View File

@ -53,7 +53,7 @@ if ( ! function_exists( 'fictioneer_seo_fields' ) ) {
function fictioneer_seo_fields( $post ) { function fictioneer_seo_fields( $post ) {
// Title // Title
$seo_title = get_post_meta( $post->ID, 'fictioneer_seo_title', true ) ?? '{{title}} {{site}}'; $seo_title = get_post_meta( $post->ID, 'fictioneer_seo_title', true ) ?? '{{title}} {{site}}';
$seo_title_placeholder = fictioneer_get_safe_title( $post->ID ) . ' ' . get_bloginfo( 'name' ); $seo_title_placeholder = fictioneer_get_safe_title( $post->ID ) . ' ' . ( FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ) );
// Description (truncated if necessary) // Description (truncated if necessary)
$seo_description = get_post_meta( $post->ID, 'fictioneer_seo_description', true ) ?? '{{excerpt}}'; $seo_description = get_post_meta( $post->ID, 'fictioneer_seo_description', true ) ?? '{{excerpt}}';
@ -215,7 +215,7 @@ if ( ! function_exists( 'fictioneer_get_seo_title' ) ) {
$post_id = $post_id ? $post_id : get_queried_object_id(); $post_id = $post_id ? $post_id : get_queried_object_id();
$page = get_query_var( 'paged', 0 ); // Only default pagination is considered $page = get_query_var( 'paged', 0 ); // Only default pagination is considered
$page_note = $page > 1 ? sprintf( __( ' Page %s', 'fictioneer' ), $page ) : ''; $page_note = $page > 1 ? sprintf( __( ' Page %s', 'fictioneer' ), $page ) : '';
$site_name = get_bloginfo( 'name' ); $site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$skip_cache = isset( $args['skip_cache'] ) && $args['skip_cache']; $skip_cache = isset( $args['skip_cache'] ) && $args['skip_cache'];
$default = isset( $args['default'] ) && ! empty( $args['default'] ) ? $args['default'] : false; $default = isset( $args['default'] ) && ! empty( $args['default'] ) ? $args['default'] : false;
@ -376,7 +376,7 @@ if ( ! function_exists( 'fictioneer_get_seo_description' ) ) {
function fictioneer_get_seo_description( $post_id = null, $args = [] ) { function fictioneer_get_seo_description( $post_id = null, $args = [] ) {
// Setup // Setup
$post_id = $post_id ? $post_id : get_queried_object_id(); $post_id = $post_id ? $post_id : get_queried_object_id();
$site_name = get_bloginfo( 'name' ); $site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$skip_cache = isset( $args['skip_cache'] ) && $args['skip_cache']; $skip_cache = isset( $args['skip_cache'] ) && $args['skip_cache'];
$default = isset( $args['default'] ) && ! empty( $args['default'] ) ? $args['default'] : false; $default = isset( $args['default'] ) && ! empty( $args['default'] ) ? $args['default'] : false;
@ -497,7 +497,7 @@ if ( ! function_exists( 'fictioneer_get_seo_description' ) ) {
// Catch empty // Catch empty
if ( empty( $seo_description ) ) { if ( empty( $seo_description ) ) {
$seo_description = $default ? $default : get_bloginfo( 'description' ); $seo_description = $default ? $default : ( FICTIONEER_SITE_DESCRIPTION ?: get_bloginfo( 'description' ) );
} }
// Finalize // Finalize
@ -649,7 +649,7 @@ if ( ! function_exists( 'fictioneer_output_head_seo' ) ) {
<meta property="og:title" content="<?php echo $og_title; ?>"> <meta property="og:title" content="<?php echo $og_title; ?>">
<meta property="og:description" content="<?php echo $og_description; ?>"> <meta property="og:description" content="<?php echo $og_description; ?>">
<meta property="og:url" content="<?php echo $canonical_url; ?>"> <meta property="og:url" content="<?php echo $canonical_url; ?>">
<meta property="og:site_name" content="<?php echo get_bloginfo( 'name' ); ?>"> <meta property="og:site_name" content="<?php echo FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ); ?>">
<?php if ( ! $is_aggregated && $is_article ) : ?> <?php if ( ! $is_aggregated && $is_article ) : ?>

View File

@ -881,7 +881,7 @@ if ( ! function_exists( 'fictioneer_output_head_meta' ) ) {
$font_link = get_template_directory_uri() . '/css/fonts.css?ver=' . FICTIONEER_VERSION; $font_link = get_template_directory_uri() . '/css/fonts.css?ver=' . FICTIONEER_VERSION;
// Start HTML ---> ?> // Start HTML ---> ?>
<meta charset="<?php bloginfo( 'charset' ); ?>"> <meta charset="<?php echo FICTIONEER_SITE_CHARSET ?: get_bloginfo( 'charset' ); ?>">
<meta http-equiv="content-type" content="text/html"> <meta http-equiv="content-type" content="text/html">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5.0, viewport-fit=cover"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5.0, viewport-fit=cover">

View File

@ -525,7 +525,7 @@ if ( ! function_exists( 'fictioneer_output_rss' ) ) {
if ( $post_type == 'fcn_story' && ! $skip_to_default ) { if ( $post_type == 'fcn_story' && ! $skip_to_default ) {
$title = sprintf( $title = sprintf(
_x( '%1$s - %2$s Chapters', 'Story Feed: [Site] - [Story] Chapters.', 'fictioneer' ), _x( '%1$s - %2$s Chapters', 'Story Feed: [Site] - [Story] Chapters.', 'fictioneer' ),
get_bloginfo( 'name' ), FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ),
get_the_title( get_the_ID() ) get_the_title( get_the_ID() )
); );
@ -539,7 +539,7 @@ if ( ! function_exists( 'fictioneer_output_rss' ) ) {
if ( $post_type == 'fcn_chapter' && ! empty( $story_id ) && ! $skip_to_default ) { if ( $post_type == 'fcn_chapter' && ! empty( $story_id ) && ! $skip_to_default ) {
$title = sprintf( $title = sprintf(
_x( '%1$s - %2$s Chapters', 'Story Feed: [Site] - [Story] Chapters.', 'fictioneer' ), _x( '%1$s - %2$s Chapters', 'Story Feed: [Site] - [Story] Chapters.', 'fictioneer' ),
get_bloginfo( 'name' ), FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ),
get_the_title( $story_id ) get_the_title( $story_id )
); );
@ -551,7 +551,7 @@ if ( ! function_exists( 'fictioneer_output_rss' ) ) {
if ( empty( $rss_link ) ) { if ( empty( $rss_link ) ) {
$title = sprintf( $title = sprintf(
_x( '%s Feed', '[Site] Feed', 'fictioneer' ), _x( '%s Feed', '[Site] Feed', 'fictioneer' ),
get_bloginfo( 'name' ) FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' )
); );
$url = esc_url( home_url( 'feed' ) ); $url = esc_url( home_url( 'feed' ) );

View File

@ -387,6 +387,7 @@ if ( ! function_exists( 'fictioneer_comment_notification' ) ) {
} }
// Setup // Setup
$site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$comment_text = apply_filters( 'get_comment_text', $commentdata['comment_content'] ); $comment_text = apply_filters( 'get_comment_text', $commentdata['comment_content'] );
$comment_text = apply_filters( 'comment_text', $comment_text ); $comment_text = apply_filters( 'comment_text', $comment_text );
$comment_author = empty( $parent->comment_author ) ? fcntr( 'anonymous_guest' ) : $parent->comment_author; $comment_author = empty( $parent->comment_author ) ? fcntr( 'anonymous_guest' ) : $parent->comment_author;
@ -412,7 +413,7 @@ if ( ! function_exists( 'fictioneer_comment_notification' ) ) {
), ),
'[[reply_excerpt]]' => get_comment_excerpt( $comment_id ), '[[reply_excerpt]]' => get_comment_excerpt( $comment_id ),
'[[reply_content]]' => $comment_text, '[[reply_content]]' => $comment_text,
'[[site_title]]' => get_bloginfo( 'name' ), '[[site_title]]' => $site_name,
'[[site_url]]' => site_url(), '[[site_url]]' => site_url(),
'[[unsubscribe_url]]' => add_query_arg( '[[unsubscribe_url]]' => add_query_arg(
'code', 'code',
@ -424,7 +425,7 @@ if ( ! function_exists( 'fictioneer_comment_notification' ) ) {
); );
$from_address = get_option( 'fictioneer_system_email_address' ); $from_address = get_option( 'fictioneer_system_email_address' );
$from_name = get_option( 'fictioneer_system_email_name' ); $from_name = get_option( 'fictioneer_system_email_name' );
$from_name = empty ( $from_name ) ? get_bloginfo( 'name' ) : $from_name; $from_name = empty ( $from_name ) ? $site_name : $from_name;
$headers = []; $headers = [];
$headers[] = 'Content-Type: text/html; charset=UTF-8'; $headers[] = 'Content-Type: text/html; charset=UTF-8';
@ -437,7 +438,7 @@ if ( ! function_exists( 'fictioneer_comment_notification' ) ) {
'to' => $parent->comment_author_email, 'to' => $parent->comment_author_email,
'subject' => sprintf( 'subject' => sprintf(
_x( 'New reply to your comment on %s', 'Reply notification email subject.', 'fictioneer' ), _x( 'New reply to your comment on %s', 'Reply notification email subject.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'message' => $template, 'message' => $template,
'headers' => $headers, 'headers' => $headers,

View File

@ -64,7 +64,7 @@ if ( ! function_exists( 'fictioneer_build_chapter_schema' ) ) {
$page_title = fictioneer_get_seo_title( $page_title = fictioneer_get_seo_title(
$post_id, $post_id,
array( array(
'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . get_bloginfo( 'name' ), 'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . ( FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ) ),
'skip_cache' => true 'skip_cache' => true
) )
); );

View File

@ -83,6 +83,7 @@ if ( ! function_exists( 'fictioneer_build_chapters_schema' ) ) {
); );
// Setup // Setup
$site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$list = get_posts( $query_args ); $list = get_posts( $query_args );
$schema = fictioneer_get_schema_node_root(); $schema = fictioneer_get_schema_node_root();
$image_data = fictioneer_get_schema_primary_image( $post_id ); $image_data = fictioneer_get_schema_primary_image( $post_id );
@ -90,7 +91,7 @@ if ( ! function_exists( 'fictioneer_build_chapters_schema' ) ) {
$page_description = fictioneer_get_seo_description( $post_id, array( $page_description = fictioneer_get_seo_description( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'All chapters hosted on %s.', 'fictioneer' ), __( 'All chapters hosted on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -98,7 +99,7 @@ if ( ! function_exists( 'fictioneer_build_chapters_schema' ) ) {
$page_title = fictioneer_get_seo_title( $post_id, array( $page_title = fictioneer_get_seo_title( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'Chapters %s.', 'fictioneer' ), __( 'Chapters %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -127,7 +128,7 @@ if ( ! function_exists( 'fictioneer_build_chapters_schema' ) ) {
__( 'Chapters', 'fictioneer' ), __( 'Chapters', 'fictioneer' ),
sprintf( sprintf(
__( 'List of chapters on %s.', 'fictioneer' ), __( 'List of chapters on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'#article' '#article'
); );

View File

@ -79,6 +79,7 @@ if ( ! function_exists( 'fictioneer_build_collections_schema' ) ) {
); );
// Setup // Setup
$site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$list = get_posts( $query_args ); $list = get_posts( $query_args );
$schema = fictioneer_get_schema_node_root(); $schema = fictioneer_get_schema_node_root();
$image_data = fictioneer_get_schema_primary_image( $post_id ); $image_data = fictioneer_get_schema_primary_image( $post_id );
@ -86,7 +87,7 @@ if ( ! function_exists( 'fictioneer_build_collections_schema' ) ) {
$page_description = fictioneer_get_seo_description( $post_id, array( $page_description = fictioneer_get_seo_description( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'Collections on %s.', 'fictioneer' ), __( 'Collections on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -94,7 +95,7 @@ if ( ! function_exists( 'fictioneer_build_collections_schema' ) ) {
$page_title = fictioneer_get_seo_title( $post_id, array( $page_title = fictioneer_get_seo_title( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'Collections %s.', 'fictioneer' ), __( 'Collections %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -123,7 +124,7 @@ if ( ! function_exists( 'fictioneer_build_collections_schema' ) ) {
__( 'Collections', 'fictioneer' ), __( 'Collections', 'fictioneer' ),
sprintf( sprintf(
__( 'List of collections on %s.', 'fictioneer' ), __( 'List of collections on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'#article' '#article'
); );

View File

@ -56,7 +56,7 @@ if ( ! function_exists( 'fictioneer_build_post_schema' ) ) {
$page_description = fictioneer_get_seo_description( $post_id ); $page_description = fictioneer_get_seo_description( $post_id );
$page_title = fictioneer_get_seo_title( $post_id, array( $page_title = fictioneer_get_seo_title( $post_id, array(
'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . get_bloginfo( 'name' ), 'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . ( FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ) ),
'skip_cache' => true 'skip_cache' => true
)); ));

View File

@ -65,7 +65,7 @@ if ( ! function_exists( 'fictioneer_build_recommendation_schema' ) ) {
$page_title = fictioneer_get_seo_title( $page_title = fictioneer_get_seo_title(
$post_id, $post_id,
array( array(
'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . get_bloginfo( 'name' ), 'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . ( FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ) ),
'skip_cache' => true 'skip_cache' => true
) )
); );

View File

@ -79,6 +79,7 @@ if ( ! function_exists( 'fictioneer_build_recommendations_schema' ) ) {
); );
// Setup // Setup
$site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$list = get_posts( $query_args ); $list = get_posts( $query_args );
$schema = fictioneer_get_schema_node_root(); $schema = fictioneer_get_schema_node_root();
$image_data = fictioneer_get_schema_primary_image( $post_id ); $image_data = fictioneer_get_schema_primary_image( $post_id );
@ -86,7 +87,7 @@ if ( ! function_exists( 'fictioneer_build_recommendations_schema' ) ) {
$page_description = fictioneer_get_seo_description( $post_id, array( $page_description = fictioneer_get_seo_description( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'Recommendations on %s.', 'fictioneer' ), __( 'Recommendations on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -94,7 +95,7 @@ if ( ! function_exists( 'fictioneer_build_recommendations_schema' ) ) {
$page_title = fictioneer_get_seo_title( $post_id, array( $page_title = fictioneer_get_seo_title( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'Recommendations %s.', 'fictioneer' ), __( 'Recommendations %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -123,7 +124,7 @@ if ( ! function_exists( 'fictioneer_build_recommendations_schema' ) ) {
__( 'Recommendations', 'fictioneer' ), __( 'Recommendations', 'fictioneer' ),
sprintf( sprintf(
__( 'List of recommendations on %s.', 'fictioneer' ), __( 'List of recommendations on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'#article' '#article'
); );

View File

@ -79,6 +79,7 @@ if ( ! function_exists( 'fictioneer_build_stories_schema' ) ) {
); );
// Setup // Setup
$site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$list = get_posts( $query_args ); $list = get_posts( $query_args );
$schema = fictioneer_get_schema_node_root(); $schema = fictioneer_get_schema_node_root();
$image_data = fictioneer_get_schema_primary_image( $post_id ); $image_data = fictioneer_get_schema_primary_image( $post_id );
@ -86,7 +87,7 @@ if ( ! function_exists( 'fictioneer_build_stories_schema' ) ) {
$page_description = fictioneer_get_seo_description( $post_id, array( $page_description = fictioneer_get_seo_description( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'All stories hosted on %s.', 'fictioneer' ), __( 'All stories hosted on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -94,7 +95,7 @@ if ( ! function_exists( 'fictioneer_build_stories_schema' ) ) {
$page_title = fictioneer_get_seo_title( $post_id, array( $page_title = fictioneer_get_seo_title( $post_id, array(
'default' => sprintf( 'default' => sprintf(
__( 'Stories %s.', 'fictioneer' ), __( 'Stories %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'skip_cache' => true 'skip_cache' => true
)); ));
@ -123,7 +124,7 @@ if ( ! function_exists( 'fictioneer_build_stories_schema' ) ) {
__( 'Stories', 'fictioneer' ), __( 'Stories', 'fictioneer' ),
sprintf( sprintf(
__( 'List of stories on %s.', 'fictioneer' ), __( 'List of stories on %s.', 'fictioneer' ),
get_bloginfo( 'name' ) $site_name
), ),
'#article' '#article'
); );

View File

@ -80,7 +80,7 @@ if ( ! function_exists( 'fictioneer_build_story_schema' ) ) {
$page_title = fictioneer_get_seo_title( $page_title = fictioneer_get_seo_title(
$post_id, $post_id,
array( array(
'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . get_bloginfo( 'name' ), 'default' => fictioneer_get_safe_title( $post_id ) . ' &ndash; ' . ( FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ) ),
'skip_cache' => true 'skip_cache' => true
) )
); );

View File

@ -64,7 +64,7 @@
<i class="fa-solid fa-masks-theater reset" id="site-setting-theme-reset"></i> <i class="fa-solid fa-masks-theater reset" id="site-setting-theme-reset"></i>
<div class="select-wrapper"> <div class="select-wrapper">
<select name="site-theme" class="site-setting-site-theme"> <select name="site-theme" class="site-setting-site-theme">
<option value="default" selected="selected"><?php _ex( 'Theme:', 'Site settings modal theme selection: Current Theme.', 'fictioneer' ) ?> <?php echo get_bloginfo( 'name' ); ?></option> <option value="default" selected="selected"><?php _ex( 'Theme:', 'Site settings modal theme selection: Current Theme.', 'fictioneer' ) ?> <?php echo FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' ); ?></option>
<option value="base"><?php _ex( 'Theme: Fictioneer Base', 'Site settings modal theme selection: Base Theme.', 'fictioneer' ) ?></option> <option value="base"><?php _ex( 'Theme: Fictioneer Base', 'Site settings modal theme selection: Base Theme.', 'fictioneer' ) ?></option>
</select> </select>
</div> </div>

View File

@ -15,6 +15,13 @@
*/ */
?> ?>
<?php
$site_name = FICTIONEER_SITE_NAME ?: get_bloginfo( 'name' );
$site_description = FICTIONEER_SITE_DESCRIPTION ?: get_bloginfo( 'description' );
?>
<header class="header hide-on-fullscreen"> <header class="header hide-on-fullscreen">
<?php do_action( 'fictioneer_header', $args ); ?> <?php do_action( 'fictioneer_header', $args ); ?>
@ -27,9 +34,9 @@
<?php elseif ( display_header_text() ) : ?> <?php elseif ( display_header_text() ) : ?>
<div class="header__title"> <div class="header__title">
<h1 class="header__title-heading"><a href="<?php echo esc_url( home_url() ); ?>" class="header__title-link" rel="home"><?php echo get_bloginfo( 'name' ); ?></a></h1> <h1 class="header__title-heading"><a href="<?php echo esc_url( home_url() ); ?>" class="header__title-link" rel="home"><?php echo $site_name; ?></a></h1>
<?php if ( ! empty( get_bloginfo( 'description' ) ) ) : ?> <?php if ( ! empty( $site_description ) ) : ?>
<div class="header__title-tagline"><?php echo get_bloginfo( 'description' ); ?></div> <div class="header__title-tagline"><?php echo $site_description; ?></div>
<?php endif; ?> <?php endif; ?>
</div> </div>