我正在構建自己的 wordpress 主題,但我遇到了這樣的問題。媒體庫不起作用,我無法向頁面添加任何影像。我正在使用最新版本的 wordpress。可用的檔案github https://github.com/krysba/themes-wordpress
當我打開標準的 wordpress 主題時,圖書館作業:(我正在尋求幫助來解決這個問題。
uj5u.com熱心網友回復:
如果您還沒有嘗試過,我會嘗試的第一件事是從 wp-config.php 在 Wordpress 上啟用除錯模式,并檢查一些警報或錯誤是否有幫助。
define('WP_DEBUG', true);
uj5u.com熱心網友回復:
謝謝,我打開了除錯,但它沒有顯示錯誤
define( 'WP_DEBUG', true );
define( 'WP_DEBUG _LOG', true);
define( 'WP_DEBUG_DISPLAY', true);
uj5u.com熱心網友回復:
我認為您必須嘗試注釋所有 function.php 并逐行除錯它。在第一次檢查中,我發現函式 add_theme_support 和入隊檔案的錯誤使用。
例如,用戶 add_theme_support 的正確方法是在 after_setup_theme 操作上:
function my_setup_theme(){
add_theme_support('post-formats',array('gallery','link','image','quote','status','video','audio'));
}
add_action( 'after_setup_theme', 'my_setup_theme' );
對腳本或樣式進行排隊的正確方法是:
function add_theme_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
在此頁面上查看:https ://developer.wordpress.org/themes/basics/including-css-javascript/
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/471376.html
標籤:WordPress
