標籤: Avada
正在檢視 4 個帖子:1-4 (共 4 個帖子)
-
作者帖子
-
嘗試著編輯站點頁面,但是發現居然找不到頁面模板設定了,本身使用 Avada 主題會自帶的有一些內建的頁面模板,但是早上該內容找不到了。
到官方找了下解決方案:
WordPress 從 4.9 版本引入了一個快取機制到主題中獲取檔案列表。這也導致頁面編輯螢幕頁面屬性元框中的頁面模板快取。當使用子主題時,更新到 WordPress 4.9 並將 Avada 更新到 5.3 後,某些使用者從下拉選單中缺少頁面模板。
一段時間後,問題將得到自動更正,當一個主題的檔案快取清除。不幸的是,無法立即清除它。整個問題目前被歸類為一個 WordPress 的核心問題,這裡跟蹤 https://core.trac.wordpress.org/ticket/42573,並希望在 WordPress 4.9.1 中解決。
TEMPORARY SOLUTION:為了立即清除快取,你可以在下面下載這個小外掛,並透過 WP Dashboard> Plugins> Add New 進行安裝。點選上傳外掛按鈕,安裝完成後啟用外掛。外掛名稱是:修復主題模板檔案快取 (WP Trac#42573) 。最後開啟一個頁面編輯螢幕。現在所有頁面模板都應該可以再次使用。一旦情況如此,您可以再次解除安裝該外掛。
臨時解決辦法,外掛下載:
https://theme-fusion.com/wp-content/uploads/2017/11/fix-page-templates.zip
外掛啟用後,什麼都不用管,只需要安裝會自動清除快取,不需要了刪除即可。
外掛程式碼其實也比較簡單,就是一段 PHP 程式碼段,不想裝外掛的就直接複製到子主題的 function.php 裡面儲存下,然後清除就好。
/** * Plugin name: Fix for theme template file caching (WP Trac #42573) * Description: Flush the theme file cache each time the admin screens are loaded which uses the file list. * Author: Weston Ruter, XWP. * Plugin URI: https://core.trac.wordpress.org/ticket/42573 */ function wp_42573_fix_template_caching( WP_Screen $current_screen ) { // Only flush the file cache with each request to post list table, edit post screen, or theme editor. if ( ! in_array( $current_screen->base, array( 'post', 'edit', 'theme-editor' ), true ) ) { return; } $theme = wp_get_theme(); if ( ! $theme ) { return; } $cache_hash = md5( $theme->get_theme_root() . '/' . $theme->get_stylesheet() ); $label = sanitize_key( 'files_' . $cache_hash . '-' . $theme->get( 'Version' ) ); $transient_key = substr( $label, 0, 29 ) . md5( $label ); delete_transient( $transient_key ); } add_action( 'current_screen', 'wp_42573_fix_template_caching' );
-
作者帖子
正在檢視 4 個帖子:1-4 (共 4 個帖子)
- 哎呀,回覆話題必需登入。