Skip to content

Instantly share code, notes, and snippets.

@ericandrewlewis
Created June 28, 2012 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericandrewlewis/3013007 to your computer and use it in GitHub Desktop.
Save ericandrewlewis/3013007 to your computer and use it in GitHub Desktop.
Plugin bootstrapper with theme check
<?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