wordpress中媒体库的问题



我正在建立自己的wordpress主题,我有这样一个问题。媒体库不起作用,我无法向页面添加任何图像。我使用的是最新版本的wordpress。github https://github.com/krysba/themes-wordpress上可用的文件当我打开标准的wordpress主题时,库工作:(我正在寻求帮助来解决这个问题。

如果你还没有尝试过,我要尝试的第一件事是在Wordpress上从wp-config.php启用调试模式,并检查是否有一些警报或错误可以帮助。

define('WP_DEBUG', true);

我认为你必须尝试注释所有的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/

最新更新