Created
May 6, 2015 05:20
-
-
Save Ataurr/0072dbff154b03d432c5 to your computer and use it in GitHub Desktop.
how to require the Unyson Framework on your theme / plugin without TGM
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
Here's it: | |
in your theme (functions.php) / plugin (plugin-name.php) file drop this | |
//wp error messages system function | |
function PLUGIN_NAME_requirement_admin_notice() { | |
?> | |
<div class="error"> | |
<p><?php _e( 'PLUGIN_NAME requires <a href="'.get_admin_url().'/plugin-install.php?tab=plugin-information&plugin=PLUGIN_ID&TB_iframe=true" class="thickbox" aria-label="More information about Unyson" data-title="Unyson">Unyson Framework</a>', 'YOUR_TEXT_DOMAIN' ); ?></p> | |
</div> | |
<?php | |
} | |
//check framework and show message | |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
if ( is_plugin_inactive('unyson/unyson.php') ) { | |
add_action( 'admin_notices', 'PLUGIN_NAME_requirement_admin_notice' ); | |
} | |
replace all PLUGIN_NAME with what it says | |
replace all PLUGIN_ID with the exact plugin name, like unyson | |
replace YOUR_TEXT_DOMAIN with your own | |
Disable / enable the UNYSON plugin to check if this code works (it's perfect for me). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment