Improve static file cache identifier
This commit is contained in:
parent
a806f73b59
commit
ec73563d4b
@ -3067,12 +3067,13 @@ function fictioneer_get_post_patreon_data( $post = null ) {
|
||||
* @see get_template_part()
|
||||
*
|
||||
* @param string $slug The slug name for the generic template.
|
||||
* @param string $identifier Optional. Additional identifier string for the file. Default empty string.
|
||||
* @param int|null $expiration Optional. Seconds until the cache expires. Default 24 hours in seconds.
|
||||
* @param string|null $name Optional. The name of the specialized template.
|
||||
* @param array $args Optional. Additional arguments passed to the template.
|
||||
*/
|
||||
|
||||
function fictioneer_get_static_template_part( $slug, $expiration = null, $name = null, $args = [] ) {
|
||||
function fictioneer_get_static_template_part( $slug, $identifier = '', $expiration = null, $name = null, $args = [] ) {
|
||||
// Use default function if...
|
||||
if (
|
||||
! get_option( 'fictioneer_enable_static_partials' ) ||
|
||||
@ -3085,7 +3086,7 @@ function fictioneer_get_static_template_part( $slug, $expiration = null, $name =
|
||||
}
|
||||
|
||||
// Setup
|
||||
$args_hash = md5( serialize( $args ) );
|
||||
$args_hash = md5( serialize( $args ) . $identifier );
|
||||
$static_file = $slug . ( $name ? "-{$name}" : '' ) . "-{$args_hash}.html";
|
||||
$path = get_template_directory() . '/cache/html/' . $static_file;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
fictioneer_get_static_template_part( 'partials/_template_bookmark', null, null, $args );
|
||||
fictioneer_get_static_template_part( 'partials/_template_bookmark', '', null, null, $args );
|
||||
|
||||
?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user