Include Minit plugin in theme [closed]

Well, Minit for WordPress is hooked into the plugins_loaded action hook (you can see that checking the file minit.php).

And the thing is you are requiring the file minit.php in your functions.php, which is a file loaded after the hook plugins_loaded is called. This means that Minit is not being initialized the proper way.

So, basically, you have two choices:

  1. Put minit-master directory inside your plugins directory so you can load minit.php like it should be loaded, as a WordPress plugin.

  2. Or you could keep the way you want by changing the source code of minit.php to be loaded within after_setup_theme hook:

<?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' ) );