Advertisement
xpeed

how to require the Unyson Framework on your theme / plugin w

May 6th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. Here's it:
  2.  
  3. in your theme (functions.php) / plugin (plugin-name.php) file drop this
  4. //wp error messages system function
  5. function PLUGIN_NAME_requirement_admin_notice() {
  6. ?>
  7. <div class="error">
  8.     <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>
  9. </div>
  10. <?php
  11. }
  12. //check framework and show message
  13. include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  14. if ( is_plugin_inactive('unyson/unyson.php') ) {
  15. add_action( 'admin_notices', 'PLUGIN_NAME_requirement_admin_notice' );
  16. }
  17. replace all PLUGIN_NAME with what it says
  18. replace all PLUGIN_ID with the exact plugin name, like unyson
  19. replace YOUR_TEXT_DOMAIN with your own
  20. Disable / enable the UNYSON plugin to check if this code works (it's perfect for me).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement