Skip to content

Make it possible to use as a library inside a Theme #4

Closed
julien-c opened this Issue Mar 28, 2012 · 5 comments

2 participants

@julien-c

I think this would be most useful as a library inside a Theme, not as a plugin (see my use case on WPSE: http://wordpress.stackexchange.com/questions/46364/plugin-or-theme-containing-its-own-plugins)

However, it currently doesn't work because plugins_loaded (the hook used to add more plugins) is fired before the theme is even loaded.

Is there a way to make it work by plugging into another hook than plugins_loaded?

Thanks!

@chrisguitarguy
Owner

You could change plugins_loaded for after_setup_theme. The two times this hooks into plugins_loaded could be switched without many consequences.

The question is whether it should! If you're bundling plugins with your theme, I'd suggest not using this plugin in its entirety. Just add a view to the plugin list table that displays the plugins added and included by your theme. You don't need your users to turn them on/off right? And this doesn't updates for plugins found in other directories.

@julien-c

I actually do need my users to turn them on/off (all the plugins are off by default for simplicity's sake).

I'll try to include the plugins on another later hook then. I guess some plugin functionality might get broken though, right?

Thanks!

@chrisguitarguy
Owner

I'm not sure if any functionality of this would get broken from moving plugins to loading later. But, honestly, your one use case isn't enough incentive to change the code.

I think what you're trying to do is more akin to adding and removing features from a theme based on user options -- which can more easily be done from an options page.

@julien-c

Except that I will encourage my users to download plugins after installing the theme (not all plugins will be included in the theme) and install them into my theme's plugins subfolder -- which is why I think a plugin dir. would make more sense than options.

I'll be following the evolution of this plugin anyways, thanks!

@chrisguitarguy
Owner

Ah, gotcha. That makes sense. I'd think I'd just take the approach of creating those integrations and mentioning then letting the users install plugins if they want. This is still a bit to hackish to work well for that use case -- the core would need to be changed to make it happen more nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.