inkthemes_plugins_notify

Register the required plugins for this theme.

Description

inkthemes_plugins_notify(); 

In this example, we register two plugins - one included with the TGMPA library and one from the .org repo.

The variable passed to tgmpa_register_plugins() should be an array of plugin arrays.

This function is hooked into tgmpa_init, which is fired within the TGM_Plugin_Activation class constructor.


Usage

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

Defined (1)

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

/functions/inkthemes-plugin-notify.php  
  1. function inkthemes_plugins_notify() { 
  2. /** 
  3. * Array of plugin arrays. Required keys are name and slug. 
  4. * If the source is NOT from the .org repo, then source is also required. 
  5. */ 
  6. $plugins = array( 
  7. // Option tree plugin from the WordPress Plugin Repository. 
  8. array( 
  9. 'name' => 'FormGet Contact Form',  
  10. 'slug' => 'formget-contact-form',  
  11. 'required' => false,  
  12. 'force_activation' => false,  
  13. 'force_deactivation' => true,  
  14. ),  
  15. ); 
  16.  
  17. /** 
  18. * Array of configuration settings. Amend each line as needed. 
  19. * TGMPA will start providing localized text strings soon. If you already havetranslationsof our standard 
  20. * strings available, please help us make TGMPA even better by giving us access to thesetranslationsor by 
  21. * sending in a pull-request with .po file(s) with the translations. 
  22. * Only uncomment the strings in the config array if you want to customize the strings. 
  23. */ 
  24. $config = array( 
  25. 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. 
  26. 'default_path' => '', // Default absolute path to bundled plugins. 
  27. 'menu' => 'tgmpa-install-plugins', // Menu slug. 
  28. 'parent_slug' => 'themes.php', // Parent menu slug. 
  29. 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. 
  30. 'has_notices' => true, // Show admin notices or not. 
  31. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 
  32. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 
  33. 'is_automatic' => false, // Automatically activate plugins after installation or not. 
  34. 'message' => '', // Message to output right before the plugins table. 
  35. 'strings' => array( 
  36. 'page_title' => __( 'Install Recommended Plugins', 'colorway' ),  
  37. 'menu_title' => __( 'Install Plugins', 'colorway' ),  
  38. 'installing' => __( 'Installing Plugin: %s', 'colorway' ), // %s = plugin name. 
  39. 'oops' => __( 'Something went wrong with the plugin API.', 'colorway' ),  
  40. 'notice_can_install_required' => _n_noop( 
  41. 'This theme recommends the following plugin to add lead form on landing page: %1$s.', 'This theme requires the following plugins: %1$s.', 'colorway' 
  42. ), // %1$s = plugin name(s). 
  43. 'notice_can_install_recommended' => _n_noop( 
  44. 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.', 'colorway' 
  45. ), // %1$s = plugin name(s). 
  46. 'notice_cannot_install' => _n_noop( 
  47. 'Sorry, but you do not have the correct permissions to install the %1$s plugin.', 'Sorry, but you do not have the correct permissions to install the %1$s plugins.', 'colorway' 
  48. ), // %1$s = plugin name(s). 
  49. 'notice_ask_to_update' => _n_noop( 
  50. 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.', 'colorway' 
  51. ), // %1$s = plugin name(s). 
  52. 'notice_ask_to_update_maybe' => _n_noop( 
  53. 'There is an update available for: %1$s.', 'There are updates available for the following plugins: %1$s.', 'colorway' 
  54. ), // %1$s = plugin name(s). 
  55. 'notice_cannot_update' => _n_noop( 
  56. 'Sorry, but you do not have the correct permissions to update the %1$s plugin.', 'Sorry, but you do not have the correct permissions to update the %1$s plugins.', 'colorway' 
  57. ), // %1$s = plugin name(s). 
  58. 'notice_can_activate_required' => _n_noop( 
  59. 'This theme recommends the following plugin to add lead form on landing page is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.', 'colorway' 
  60. ), // %1$s = plugin name(s). 
  61. 'notice_can_activate_recommended' => _n_noop( 
  62. 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.', 'colorway' 
  63. ), // %1$s = plugin name(s). 
  64. 'notice_cannot_activate' => _n_noop( 
  65. 'Sorry, but you do not have the correct permissions to activate the %1$s plugin.', 'Sorry, but you do not have the correct permissions to activate the %1$s plugins.', 'colorway' 
  66. ), // %1$s = plugin name(s). 
  67. 'install_link' => _n_noop( 
  68. 'Begin installing plugin', 'Begin installing plugins', 'colorway' 
  69. ),  
  70. 'update_link' => _n_noop( 
  71. 'Begin updating plugin', 'Begin updating plugins', 'colorway' 
  72. ),  
  73. 'activate_link' => _n_noop( 
  74. 'Begin activating plugin', 'Begin activating plugins', 'colorway' 
  75. ),  
  76. 'return' => __( 'Return to Required Plugins Installer', 'colorway' ),  
  77. 'plugin_activated' => __( 'Plugin activated successfully.', 'colorway' ),  
  78. 'activated_successfully' => __( 'The following plugin was activated successfully:', 'colorway' ),  
  79. 'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'colorway' ), // %1$s = plugin name(s). 
  80. 'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'colorway' ), // %1$s = plugin name(s). 
  81. 'complete' => __( 'All plugins installed and activated successfully. %1$s', 'colorway' ), // %s = dashboard link. 
  82. 'contact_admin' => __( 'Please contact the administrator of this site for help.', 'colorway' ),  
  83. 'nag_type' => 'updated', // Determines admin notice type - can only be 'updated', 'update-nag' or error. 
  84. ),  
  85. ); 
  86.  
  87.  
  88. tgmpa( $plugins, $config );