Home › Forums › Back End › Theme dependent plugin › Reply To: Theme dependent plugin
December 26, 2015 at 5:32 am
#236156
Alen
Participant
I am creating a WP plugin which will require either of two themes so that it can work
Why? I would never use your plugin. Why do I have to use theme other than my own?
as it’s using the theme functions inherited from either of the plugins
Functions inherited from theme? or plugin? Why not extract the functions you need and decouple your code.
$supported_themes = array('theme-1', 'theme-1');
if ( ! in_array( wp_get_theme(), $supported_themes ) ) {
add_action( 'admin_notices', function() {
echo '<div class="error"><p>Activate Supported Theme</p></div>';
} );
return;
}
Hope that helps.
Alen