wordpress - Wordpress:Twig 文件未在浏览器中呈现更改
问题描述
我想我遇到了某种缓存问题,或者我对木材/树枝太陌生了,以至于我完全错过了一些东西?我正在使用开发人员工具,可以看到该页面正在使用它应该使用的 hero_jobs.php 控制器文件,并且页面英雄正在为工作图像渲染 ACF,但突然间我变小了对树枝文件的更改,并且没有任何更改在浏览器中呈现。我首先只是尝试更改与控制器文件无关的图像上的类。浏览器没有任何变化。我还删除了作业图像的代码,图像仍在浏览器中呈现。该站点使用组件化插件,并且 Job Hero 的 ACF 字段组指向正确的控制器文件。
我已经禁用了开发者工具中的缓存,我研究了如何禁用木材中的缓存,卸载了 WC3 缓存,并且我还安装了一个清晰的木材缓存插件。仍然没有呈现我的更改。我不知道该尝试什么,或者问题是缓存问题?
我想我在后端也有缓存问题。我更新了字段组并删除了两个字段并添加了两个新字段,它们出现在编辑器中,现在它们已恢复为旧字段。我
我正在运行 MAMP,我尝试重新启动它、重新启动计算机、从 Time Machine 恢复数据库和站点文件,但它仍然显示错误的字段。
我已经为我雇主的网站创建了一个新模板,该模板是由一家大型外部公司开发的,所以它非常复杂,但我正在学习。
更新:我找到了缓存设置所在的 wood.php 文件,并将它们全部设置为 CACHE_NONE 但我仍然没有得到要渲染的模板。
/**
* Compile a Twig file.
*
* Passes data to a Twig file and returns the output.
*
* @api
* @example
* ```php
* $data = array(
* 'firstname' => 'Jane',
* 'lastname' => 'Doe',
* 'email' => 'jane.doe@example.org',
* );
*
* $team_member = Timber::compile( 'team-member.twig', $data );
* ```
* @param array|string $filenames Name of the Twig file to render. If this is an array of files, Timber will
* render the first file that exists.
* @param array $data Optional. An array of data to use in Twig template.
* @param bool|int $expires Optional. In seconds. Use false to disable cache altogether. When passed an
* array, the first value is used for non-logged in visitors, the second for users.
* Default false.
* @param string $cache_mode Optional. Any of the cache mode constants defined in TimberLoader.
* @param bool $via_render Optional. Whether to apply optional render or compile filters. Default false.
* @return bool|string The returned output.
*/
public static function compile( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_NONE, $via_render = false ) {
if ( !defined('TIMBER_LOADED') ) {
self::init();
}
$caller = LocationManager::get_calling_script_dir(1);
$loader = new Loader($caller);
$file = $loader->choose_template($filenames);
$caller_file = LocationManager::get_calling_script_file(1);
apply_filters('timber/calling_php_file', $caller_file);
if ( $via_render ) {
$file = apply_filters('timber_render_file', $file);
} else {
$file = apply_filters('timber_compile_file', $file);
}
$output = false;
if ($file !== false) {
if ( is_null($data) ) {
$data = array();
}
if ( $via_render ) {
$data = apply_filters('timber_render_data', $data);
} else {
$data = apply_filters('timber_compile_data', $data);
}
$output = $loader->render($file, $data, $expires, $cache_mode);
}
do_action('timber_compile_done');
return $output;
}
解决方案
推荐阅读
- php - 多部分表单提交并发送电子邮件,但文件上传失败,jQuery 检查
- c - 我不明白为什么我肯定会丢失内存块
- python - 生成倾斜正弦波的图像
- c++ - 条件运算符不允许程序终止
- sql - More Elegant way to Batch Validate Phone Numbers
- r - Issues installing Plotly Dash for R
- java - Spring Boot application with a jar dependency does not run after maven build
- javascript - How to scroll to bottom of page, when a new message is sent - Socket.io
- r - Convert multiple rows into one row depending on unique values in another column
- unity3d - 统一3d | 重力比例值因设备分辨率不同而异。所以游戏对象没有达到所有设备的指定高度