[wp-hackers] a plugin of a theme's own

David House dmhouse at gmail.com
Mon Sep 19 20:46:57 GMT 2005


On 19/09/05, Owen Winkler <ringmaster at midnightcircus.com> wrote:
> Suppose for example that a theme adds a content filter for acronyms.  If
> a plugin is installed with the same feature, and they are namespaced
> differently, then the Acronym filter could be applied twice.
> 
> That's a simple example of interference that could be more significant
> in a more significant plugin.  If the acronym functionality is just part
> of the full featureset of the plugin, then turning off the plugin might
> not be a practical response to its feature collision with a theme's
> functions.php.

Once again, that's the same as overlapping behaviour between plugins.
Two different plugins providing a wide but overlapping feature set
would cause this problem.

In my opinion, the fault here is with the plugins. Good plugin design
is modular: individual pieces of functionality are seperated out into
different plugins, or at least there's an option panel to enable or
disable pieces of functionality.

> Perhaps it would be wise to allow an administrator to disable a theme's
> functions.php file entirely from the Presentation tab of the WP admin?

Of course, my modularity pipe dream may not be reality: not all
plugins are built in this way. However I don't think there's going to
be an elegant solution here: allowing turning off of a theme's
functions.php file is likely to cause numerous problems if the theme
depends on it. Example: a theme's sidebar.php file calls a function
which is defined in a theme's functions.php. Turn it off, and we get a
Fatal Error. We may be able to subvert this somewhat by just ignoring
all add_action and add_filter calls within the functions.php file
(i.e., still include it but don't let it do anything other than define
functions), but this is still going to cause problems in certain
situations. Like I said, no elegant solution.
 
> Or, at the least, a theme that wants to provide additional functionality
> via the functions.php should provide a way to disable part or all of the
> functionality that it provides.

We can't enforce that, but that would be the ideal solution.

-- 
-David House, dmhouse at gmail.com, http://xmouse.ithium.net


More information about the wp-hackers mailing list