kasparsd / minit

A WordPress plugin to combine CSS and Javascript files.
GNU General Public License v2.0
286 stars 46 forks source link

Include in theme instead of plugin #117

Closed troytempleman closed 5 years ago

troytempleman commented 5 years ago

This is great but is there a way to have it in a theme instead of a plugin? I've tried including it but it doesn't work. Does it only work upon plugin activation?

troytempleman commented 5 years ago

The answer is to change line 21 in minit.php:

add_action( 'plugins_loaded', array( 'Minit_Plugin', 'instance' ) );

to:

add_action( 'after_setup_theme', array( 'Minit_Plugin', 'instance' ) );

kasparsd commented 5 years ago

@troytempleman Correct. Or you can call Minit_Plugin::instance() directly from your theme after you've included the minit.php file.