Theme and plugin dependencies

Currently I have two child themes in the making. I basically really like the parent themes and only change minor things about them for my own use cases. When thinking about releasing one of them to the WordPress.org theme repository I already started coding a class for automatically installing  the parent theme on activation. I did not finish the script because I realized that broken themes are not allowed to run any code. Child themes without parent themes are obviously broken to WordPress.

Some themes already prompt users to install certain plugins when activated. WordPress just is what it is today because it can be enhanced with thousands of themes and plugins. Therefore I think adding dependency functionality to core is indispensable.

There are multiple ways to realize this. Child themes are dependent on parent themes. Themes can be dependent on plugins. Also plugins might enhance functionality of other plugins. My approach to this would be to introduce a new header parameter (in style.css / my-plugin.php) for dependencies: ‘plugins‘. Furthermore the ‘template‘ header might in the future also be usable in plugins. ‘plugins‘ and ‘template‘ (latter only changes for plugins) not only can include a single plugin/theme slug but multiple. Separation would be realized using commas ( , ) for ‘and’ and semicolons ( ; ) for ‘or’. The or is only required if we want to add give plugin authors the ability to restrict their plugins to specific themes. I am not sure if this is a good idea. This definitely needs discussion.

A problem with using slugs for “template” and “plugin” headers when referring to the *.org repository: Slugs are not required to be unique. So some convention would be required here. The repository uses unique URLs and this functionality could rely on the last part of it: “http://wordpress.org/extend/plugins/my-plugin-2“. Also full URLs to a zip package could be imaginable but might result in a security flaw.

With the new functionality installing a theme with dependencies would be a little different:

After activating a child-theme with missing template/parent theme the user would no longer just be prompted about its brokenness but would directly be able to install the parent theme easily: A link in an admin notice brings up the WordPress.org thickbox like when installing themes manually. Two-click installation.

Same for themes which depend on plugins: Prompt the user with a link which brings up the thickbox for easy installation. When multiple plugins are required we could also provide a “directly install all”-link which does not require opening multiple thickboxes.

I think I am more than capable of realising this project. Same as with my other two proposals: I do not have any specific request regarding a mentor. Someone with knowledge of the interaction between WordPress installs and WordPress.org would be pretty useful. Knowledge of how WordPress handles theme/plugin activations etc would be a benefit as well. Otto might be perfect for mentoring this, but I think he is not available for mentoring. Andrew suggested the idea, so maybe he might be interested in mentoring it himself?

Would like some feedback here! GSoC proposal time is running out. I hope to get in :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>