好Minit for WordPress 连接到plugins_loaded
动作挂钩(您可以看到检查文件minit.php
).
问题是你需要这份文件minit.php
在您的functions.php
, 这是挂接后加载的文件plugins_loaded
被调用。这意味着Minit 没有以正确的方式初始化。
因此,基本上,您有两个选择:
放置minit-master 目录中的目录plugins 目录,以便您可以加载minit.php
就像它应该作为WordPress插件加载一样。
或者您可以通过更改minit.php
将加载到after_setup_theme
挂钩:
<?php
/*
Plugin Name: Minit
Plugin URI: https://github.com/kasparsd/minit
GitHub URI: https://github.com/kasparsd/minit
Description: Combine JS and CSS files and serve them from the uploads folder.
Version: 1.4.1
Author: Kaspars Dambis
Author URI: https://kaspars.net
*/
// Until we add proper autoloading.
include dirname( __FILE__ ) . \'/src/minit-assets.php\';
include dirname( __FILE__ ) . \'/src/minit-asset-cache.php\';
include dirname( __FILE__ ) . \'/src/minit-js.php\';
include dirname( __FILE__ ) . \'/src/minit-css.php\';
include dirname( __FILE__ ) . \'/src/minit-plugin.php\';
include dirname( __FILE__ ) . \'/src/admin.php\';
include dirname( __FILE__ ) . \'/src/helpers.php\';
// Here we changed from `plugins_loaded` to `after_setup_theme`.
add_action( \'after_setup_theme\', array( \'Minit_Plugin\', \'instance\' ) );