The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Theme dependent plugin Reply To: Theme dependent plugin


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.