Apply static caching to selected partials
This commit is contained in:
parent
2cfe230c3a
commit
1210c2089f
@ -63,12 +63,12 @@ do_action( 'fictioneer_after_main', $args );
|
||||
$args['post_type'] == 'fcn_chapter' &&
|
||||
! post_password_required()
|
||||
) {
|
||||
get_template_part( 'partials/_tts-interface' );
|
||||
fictioneer_get_static_template_part( 'partials/_tts-interface' );
|
||||
}
|
||||
|
||||
// Render cookie banner HTML if required
|
||||
if ( get_option( 'fictioneer_cookie_banner' ) ) {
|
||||
get_template_part( 'partials/_consent-banner' );
|
||||
fictioneer_get_static_template_part( 'partials/_consent-banner' );
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -23,6 +23,9 @@ function fictioneer_watch_for_customizer_updates() {
|
||||
// Rebuild dynamic scripts
|
||||
fictioneer_build_dynamic_scripts();
|
||||
|
||||
// Clear cached HTML
|
||||
fictioneer_clear_cached_html();
|
||||
|
||||
// Files
|
||||
$bundled_fonts = WP_CONTENT_DIR . '/themes/fictioneer/cache/bundled-fonts.css';
|
||||
|
||||
|
@ -3063,7 +3063,7 @@ function fictioneer_get_post_patreon_data( $post = null ) {
|
||||
/**
|
||||
* Get template part from static cache if available
|
||||
*
|
||||
* @since 5.19.0
|
||||
* @since 5.18.1
|
||||
* @see get_template_part()
|
||||
*
|
||||
* @param string $slug The slug name for the generic template.
|
||||
@ -3125,7 +3125,7 @@ function fictioneer_get_static_template_part( $slug, $expiration = null, $name =
|
||||
* Note: Only executed once per request to reduce overhead.
|
||||
* Can therefore be used with impunity.
|
||||
*
|
||||
* @since 5.19.0
|
||||
* @since 5.18.1
|
||||
*/
|
||||
|
||||
function fictioneer_clear_cached_html() {
|
||||
|
@ -137,10 +137,10 @@ function fictioneer_output_modals( $args ) {
|
||||
// Formatting and suggestions
|
||||
if ( ! $is_archive && $args['post_type'] == 'fcn_chapter' ) {
|
||||
?><input id="modal-formatting-toggle" data-target="formatting-modal" type="checkbox" tabindex="-1" class="modal-toggle" autocomplete="off" hidden><?php
|
||||
get_template_part( 'partials/_modal-formatting' );
|
||||
fictioneer_get_static_template_part( 'partials/_modal-formatting' );
|
||||
|
||||
?><input id="modal-tts-settings-toggle" data-target="tts-settings-modal" type="checkbox" tabindex="-1" class="modal-toggle" autocomplete="off" hidden><?php
|
||||
get_template_part( 'partials/_modal-tts-settings' );
|
||||
fictioneer_get_static_template_part( 'partials/_modal-tts-settings' );
|
||||
|
||||
if (
|
||||
get_option( 'fictioneer_enable_suggestions' ) &&
|
||||
@ -148,7 +148,7 @@ function fictioneer_output_modals( $args ) {
|
||||
comments_open()
|
||||
) {
|
||||
?><input id="suggestions-modal-toggle" data-target="suggestions-modal" type="checkbox" tabindex="-1" class="modal-toggle" autocomplete="off" hidden><?php
|
||||
get_template_part( 'partials/_modal-suggestions' );
|
||||
fictioneer_get_static_template_part( 'partials/_modal-suggestions' );
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ function fictioneer_output_modals( $args ) {
|
||||
|
||||
// Site settings
|
||||
?><input id="modal-site-settings-toggle" data-target="site-settings-modal" type="checkbox" tabindex="-1" class="modal-toggle" autocomplete="off" hidden><?php
|
||||
get_template_part( 'partials/_modal-site-settings' );
|
||||
fictioneer_get_static_template_part( 'partials/_modal-site-settings' );
|
||||
|
||||
// BBCodes tutorial
|
||||
if (
|
||||
@ -174,7 +174,7 @@ function fictioneer_output_modals( $args ) {
|
||||
! fictioneer_is_commenting_disabled( $args['post_id'] )
|
||||
) {
|
||||
?><input id="modal-bbcodes-toggle" data-target="bbcodes-modal" type="checkbox" tabindex="-1" class="modal-toggle" autocomplete="off" hidden><?php
|
||||
get_template_part( 'partials/_modal-bbcodes' );
|
||||
fictioneer_get_static_template_part( 'partials/_modal-bbcodes' );
|
||||
}
|
||||
|
||||
// Story chapter changelog
|
||||
|
@ -192,7 +192,7 @@ if ( get_option( 'fictioneer_enable_follows' ) ) {
|
||||
*/
|
||||
|
||||
function fictioneer_mobile_bookmarks_frame() {
|
||||
get_template_part( 'partials/_template_mobile_bookmark' );
|
||||
fictioneer_get_static_template_part( 'partials/_template_mobile_bookmark' );
|
||||
|
||||
// Start HTML ---> ?>
|
||||
<div class="mobile-menu__frame" data-frame="bookmarks">
|
||||
|
@ -170,6 +170,9 @@ function fictioneer_settings_checkbox_added( $option, $value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear cached files
|
||||
fictioneer_clear_cached_html();
|
||||
|
||||
// Relay
|
||||
fictioneer_log_checkbox_update(
|
||||
fictioneer_get_option_label( $option ),
|
||||
@ -195,6 +198,9 @@ function fictioneer_settings_checkbox_updated( $option, $old_value, $value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear cached files
|
||||
fictioneer_clear_cached_html();
|
||||
|
||||
// Relay
|
||||
fictioneer_log_checkbox_update(
|
||||
fictioneer_get_option_label( $option ),
|
||||
@ -365,6 +371,9 @@ function fictioneer_settings_phrase_added( $option, $value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear cached files
|
||||
fictioneer_clear_cached_html();
|
||||
|
||||
// Relay
|
||||
fictioneer_log_phrase_update(
|
||||
fictioneer_get_option_label( $option ),
|
||||
@ -390,6 +399,9 @@ function fictioneer_settings_phrase_updated( $option, $old_value, $value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear cached files
|
||||
fictioneer_clear_cached_html();
|
||||
|
||||
// Replay
|
||||
fictioneer_log_phrase_update(
|
||||
fictioneer_get_option_label( $option ),
|
||||
|
@ -22,7 +22,7 @@ defined( 'ABSPATH' ) OR exit;
|
||||
$show_empty = isset( $args['show_empty'] ) && $args['show_empty'];
|
||||
$count = isset( $args['count'] ) ? intval( $args['count'] ) : -1;
|
||||
|
||||
get_template_part( 'partials/_template_bookmark', null, $args );
|
||||
fictioneer_get_static_template_part( 'partials/_template_bookmark', null, null, $args );
|
||||
|
||||
?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user