Last active
September 28, 2016 16:04
-
-
Save johnregan3/7fb06e7413bc8bb40a39f6d4027c4ca1 to your computer and use it in GitHub Desktop.
Admin notice if the WP AMP Plugin is not installed.
This file contains hidden or 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 | |
/** | |
* Show an Admin Notice if the AMP plugin is not found. | |
* | |
* This is a basic implementation. Naturally, you'll want | |
* to add ajax support so that once this is dismissed, it goes | |
* away permanently. Also, you may want to limit the admin | |
* pages this displays to prevent annoying your users. | |
* | |
* @return bool | |
*/ | |
function jr3_amp_is_active() { | |
if ( is_plugin_active( 'amp/amp.php' ) ) { | |
return false; | |
} | |
?> | |
<div class="notice notice-error is-dismissible"> | |
<p> | |
<a href="https://wordpress.org/plugins/amp/" target="_blank"><?php esc_html_e( 'The AMP plugin by Automattic', 'jr3-amp-tutorial' ); ?></a> <?php esc_html_e( 'is not installed or activated.', 'jr3-amp-tutorial' ); ?> | |
</p> | |
</div> | |
<?php | |
} | |
add_action( 'admin_notices', 'jr3_amp_is_active' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment