responsive_mobile_plugin_notice

Add notification to Reading Settings page to notify if Custom Front Page is enabled.

Description

responsive_mobile_plugin_notice(); 

Usage

  1. if ( !function_exists( 'responsive_mobile_plugin_notice' ) ) { 
  2. require_once '/core/functions-install.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = responsive_mobile_plugin_notice(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/core/functions-install.php  
  1. function responsive_mobile_plugin_notice() { 
  2. global $pagenow; 
  3. $current_user = wp_get_current_user(); 
  4. $user_id = $current_user->ID; 
  5. // Check that the user hasn't already clicked to ignore the message 
  6. // Add plugin notification only if the current user ican install plugins and on theme.php 
  7. if ( ! get_user_meta( $user_id, 'responsive_mobile_ignore_notice' ) && current_user_can( 'install_plugins' ) && 'themes.php' == $pagenow ) { 
  8.  
  9. // Set array of plugins to be suggested. 
  10. $plugins = array( 
  11. array( 
  12. 'name' => 'Clef', // Name of the plugin. 
  13. 'slug' => 'wpclef', // The plugin slug (typically the folder name) 
  14. 'uri' => 'http://wordpress.org/extend/plugins/wpclef' // plugin url ( http://wordpress.org/plugins/plugin_slug ) 
  15. ),  
  16. array( 
  17. 'name' => WpProduct Review', // The plugin name 
  18. 'slug' => 'wp-product-review', // The plugin slug (typically the folder name) 
  19. 'uri' => 'http://wordpress.org/extend/plugins/wp-product-review' 
  20. ),  
  21. array( 
  22. 'name' => 'Tweet Old Post', // The plugin name 
  23. 'slug' => 'tweet-old-post', // The plugin slug (typically the folder name) 
  24. 'uri' => 'http://wordpress.org/extend/plugins/tweet-old-post' 
  25. ); 
  26.  
  27. // Initialise plugin suggestion text. 
  28. $msg = ''; 
  29. $msg .= '<div class="updated"><p>' . __( 'This theme recommends the following plugins:', 'responsive-mobile' ) . '</br><strong>'; 
  30.  
  31. // Loop through each plugin. 
  32. foreach( $plugins as $plugin ) { 
  33.  
  34. // Get plugin object by sending plugin slug and uri. 
  35. $plugin_object = new Theme_Plugin_Dependency( $plugin['slug'], $plugin['uri'] ); 
  36.  
  37. // Display plugin name as the suggestion with link to the plugin page in wordpress.org 
  38. $msg .= ' <a target="_blank" href="' . esc_url( $plugin['uri'] ) . '">' . $plugin['name'] . '</a>'; 
  39.  
  40. // Check if the plugin is allready installed then show link to Activate it. 
  41. if ( $plugin_object->check() ) { 
  42. $msg .= ' | <a href="' . $plugin_object->activate_link() . '">' . __( 'Activate', 'responsive-mobile' ) . '</a>, </br>'; 
  43.  
  44. // Otherwise if it is not installed, but the install link is availble then show link to install it. 
  45. elseif ( $install_link = $plugin_object->install_link() ) { 
  46. $msg .= ' | <a href="' . $install_link . '">' . __( 'Install', 'responsive-mobile' ) . '</a>, </br>'; 
  47.  
  48. // If the install link is not availble then display message to install manually. 
  49. else { 
  50. $msg .= sprintf( __( '%s is not installed. Please install this plugin manually.', 'responsive-mobile' ), $plugin['name'] ) . '</br>'; 
  51. } // End of the plugin loop. 
  52.  
  53. // Show link to Hide the Notice. 
  54. $msg .= '</strong><a href="?responsive_mobile_ignore_notice=true">' . __( 'Hide Notice', 'responsive-mobile' ) . '</a></p></div>'; 
  55.  
  56. echo $msg; 
  57.