correct clear block cache
This commit is contained in:
@@ -56,7 +56,6 @@ function clear_template_cache ( $template ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Общая функция для сброса кеша на основе условий поста
|
* Общая функция для сброса кеша на основе условий поста
|
||||||
*
|
*
|
||||||
@@ -66,9 +65,9 @@ function clear_post_cache_based_on_conditions( $post_id, $post ) {
|
|||||||
|
|
||||||
// Кеш по типу поста
|
// Кеш по типу поста
|
||||||
if ($post->post_type == 'profile_article') {
|
if ($post->post_type == 'profile_article') {
|
||||||
clear_template_cache('template-parts/home/list-items');
|
|
||||||
clear_template_cache('template-parts/home/main-item');
|
clear_template_cache('template-parts/home/main-item');
|
||||||
clear_template_cache('template-parts/home/colon-item');
|
clear_template_cache('template-parts/home/colon-item');
|
||||||
|
clear_template_cache('template-parts/home/list-items'); //всегда в конце тк могут переместиться из предыдущих
|
||||||
|
|
||||||
} elseif ($post->post_type == 'anew' || $post->post_type == 'yellow') {
|
} elseif ($post->post_type == 'anew' || $post->post_type == 'yellow') {
|
||||||
clear_template_cache('template-parts/home/news');
|
clear_template_cache('template-parts/home/news');
|
||||||
@@ -78,12 +77,14 @@ function clear_post_cache_based_on_conditions( $post_id, $post ) {
|
|||||||
$main_item = get_post_meta($post_id, 'main_item', true);
|
$main_item = get_post_meta($post_id, 'main_item', true);
|
||||||
if ($main_item === 'true' || $main_item === '1') {
|
if ($main_item === 'true' || $main_item === '1') {
|
||||||
clear_template_cache('template-parts/home/main-item');
|
clear_template_cache('template-parts/home/main-item');
|
||||||
|
clear_template_cache('template-parts/home/list-items');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сброс колонки
|
// Сброс колонки
|
||||||
$colon_item = get_post_meta($post_id, 'colon_item', true);
|
$colon_item = get_post_meta($post_id, 'colon_item', true);
|
||||||
if ($colon_item === 'true' || $colon_item === '1') {
|
if ($colon_item === 'true' || $colon_item === '1') {
|
||||||
clear_template_cache('template-parts/home/colon-item');
|
clear_template_cache('template-parts/home/colon-item');
|
||||||
|
clear_template_cache('template-parts/home/list-items');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обновляем сигнальный файл
|
// Обновляем сигнальный файл
|
||||||
|
|||||||
Reference in New Issue
Block a user