![]() |
|
How to auto enable plugins for theme support - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: Themes (https://forum.zenphoto.org/forum-5.html) +--- Thread: How to auto enable plugins for theme support (/thread-8630.html) |
How to auto enable plugins for theme support - amereservant - 2011-05-18 I've tried finding something on this but had no luck. What I'm wondering is how do I auto-enable needed core plugins for a theme and if this is considered a bad idea or not? Looking at the code in [b]admin-plugins.php[/b], it appears I can set the value of the plugin using How to auto enable plugins for theme support - sbillard - 2011-05-18 Almost. It is probably not a good idea to permanantly enable the plugin, but you can do it temporarily with
would eiter be the value set by the plugin for This would need to be done at the head of each of your script files which need the plugin as it last only the duration of the page load. See, for instance, functions.php of the Effervescece+ theme which does this for the [i]print_album_menu[/i] plugin. How to auto enable plugins for theme support - amereservant - 2011-05-18 Is it possible to add the option to enable/disable the plugins from the theme's options page? Here's two possibilities I see: [list=1] How to auto enable plugins for theme support - sbillard - 2011-05-18 Yes, of course. Just add the option to your supported options list with the appropriate explaination. Still, I would not recommend that as I suspect it would be confusing to people to have theme options to enable plugins. Instead just make a theme option to control the use of the transient option setting mentioned above. Or maybe better still, just a note in your theme description that it will use the plugin if its enabled. How to auto enable plugins for theme support - amereservant - 2011-05-19 Thanks Stephen, I stumbled across the Flickrish theme, but once I installed it, it came up with a few errors and it took me a while to figure out they were plugin errors because the required plugins weren't enabled. Since Flickrish was close, but still not quite what I wanted [i](it still doesn't have the photo stream)[/i], I decided I'd spend a few days rewriting it and making it do what I wanted to begin with, which ended up being a HUGE undertaking being my first time using ZenPhoto. So... I did end up choosing the least recommended method simply for the reason the plugin can be set on/off via either the plugin page OR the theme's option page, whichever is most convenient to the user. For a newbie like me, it would've been a WHOLE lot easier if they had been on the theme's option page to begin with since I didn't care to spend a lot of time exploring the admin panel or trying to figure out how it all works. I'd love to get your feedback on the code once I get enough done to make a commit to GitHub on the revised theme if you're interested. I really appreciate your help too! Couldn't have gotten this far without it! How to auto enable plugins for theme support - sbillard - 2011-05-19 If the plugin is REQUIRED, you should use the transient option example above. If it is optional it should be selected from the plugins page. The key is whether it "uses" them or "needs" them. If it only uses them (that is it works perfectly properly without them) then you will only confuse people by allowing them to enable the plugin on the theme. If it "needs" them then the user should have to do nothing to get the theme to work--thus the theme shoud set the plugin to enabled without prompt. But of course, it should do that temporarily so as not to impact other themes. |