Created
June 28, 2012 18:14
-
-
Save ericandrewlewis/3013007 to your computer and use it in GitHub Desktop.
Plugin bootstrapper with theme check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bootstrapper() { | |
$theme = get_theme( get_current_theme() ); | |
if ( $theme['Template'] !== 'your-theme' ) | |
add_action( 'admin_notices', 'wrong_theme_notice' ); | |
else | |
plugin_init(); | |
} | |
function wrong_theme_notice() { | |
?> | |
<div id="message" class="error"> | |
Wrong theme. | |
</div><?php | |
} | |
function plugin_init() { | |
// Rest of plugin goes here. | |
} | |
bootstrapper(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment