No Description

recomended-plugin.php 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /**
  3. * This file represents an example of the code that themes would use to register
  4. * the required plugins.
  5. *
  6. * It is expected that theme authors would copy and paste this code into their
  7. * functions.php file, and amend to suit.
  8. *
  9. * @see http://tgmpluginactivation.com/configuration/ for detailed documentation.
  10. *
  11. * @package TGM-Plugin-Activation
  12. * @subpackage Example
  13. * @version 2.6.1 for child theme XShop for publication on WordPress.org
  14. * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer
  15. * @copyright Copyright (c) 2011, Thomas Griffin
  16. * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
  17. * @link https://github.com/TGMPA/TGM-Plugin-Activation
  18. */
  19. /**
  20. * Include the TGM_Plugin_Activation class.
  21. *
  22. * Depending on your implementation, you may want to change the include call:
  23. *
  24. * Parent Theme:
  25. * require_once get_template_directory() . '/path/to/class-tgm-plugin-activation.php';
  26. *
  27. * Child Theme:
  28. * require_once get_stylesheet_directory() . '/path/to/class-tgm-plugin-activation.php';
  29. *
  30. * Plugin:
  31. * require_once dirname( __FILE__ ) . '/path/to/class-tgm-plugin-activation.php';
  32. */
  33. //require_once get_stylesheet_directory() . '/path/to/class-tgm-plugin-activation.php';
  34. add_action( 'tgmpa_register', 'xshop_register_required_plugins' );
  35. /**
  36. * Register the required plugins for this theme.
  37. *
  38. * In this example, we register five plugins:
  39. * - one included with the TGMPA library
  40. * - two from an external source, one from an arbitrary source, one from a GitHub repository
  41. * - two from the .org repo, where one demonstrates the use of the `is_callable` argument
  42. *
  43. * The variables passed to the `tgmpa()` function should be:
  44. * - an array of plugin arrays;
  45. * - optionally a configuration array.
  46. * If you are not changing anything in the configuration array, you can remove the array and remove the
  47. * variable from the function call: `tgmpa( $plugins );`.
  48. * In that case, the TGMPA default settings will be used.
  49. *
  50. * This function is hooked into `tgmpa_register`, which is fired on the WP `init` action on priority 10.
  51. */
  52. function xshop_register_required_plugins() {
  53. /*
  54. * Array of plugin arrays. Required keys are name and slug.
  55. * If the source is NOT from the .org repo, then source is also required.
  56. */
  57. $plugins = array(
  58. array(
  59. 'name' => esc_html__('WooCommerce','xshop'),
  60. 'slug' => 'woocommerce',
  61. 'required' => false,
  62. ),
  63. array(
  64. 'name' => esc_html__('Click To Top','xshop'),
  65. 'slug' => 'click-to-top',
  66. 'required' => false,
  67. ),
  68. array(
  69. 'name' => esc_html__('MG Products Display','xshop'),
  70. 'slug' => 'magical-products-display',
  71. 'required' => false,
  72. ),
  73. array(
  74. 'name' => esc_html__('Easy Share','xshop'),
  75. 'slug' => 'easy-share-solution',
  76. 'required' => false,
  77. ),
  78. array(
  79. 'name' => esc_html__('MG Products Display','xshop'),
  80. 'slug' => 'magical-products-display',
  81. 'required' => false,
  82. ),
  83. array(
  84. 'name' => esc_html__('MG Posts Display','xshop'),
  85. 'slug' => 'magical-posts-display',
  86. 'required' => false,
  87. ),
  88. array(
  89. 'name' => esc_html__('MG Elementor','xshop'),
  90. 'slug' => 'magical-addons-for-elementor',
  91. 'required' => false,
  92. ),
  93. array(
  94. 'name' => esc_html__('Gallery Box','xshop'),
  95. 'slug' => 'gallery-box',
  96. 'required' => false,
  97. ),
  98. );
  99. /*
  100. * Array of configuration settings. Amend each line as needed.
  101. *
  102. * TGMPA will start providing localized text strings soon. If you already have translations of our standard
  103. * strings available, please help us make TGMPA even better by giving us access to these translations or by
  104. * sending in a pull-request with .po file(s) with the translations.
  105. *
  106. * Only uncomment the strings in the config array if you want to customize the strings.
  107. */
  108. $config = array(
  109. 'id' => 'xshop2', // Unique ID for hashing notices for multiple instances of TGMPA.
  110. 'default_path' => '', // Default absolute path to bundled plugins.
  111. 'menu' => 'tgmpa-install-plugins', // Menu slug.
  112. 'has_notices' => true, // Show admin notices or not.
  113. 'dismissable' => true, // If false, a user cannot dismiss the nag message.
  114. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
  115. 'is_automatic' => false, // Automatically activate plugins after installation or not.
  116. 'message' => '', // Message to output right before the plugins table.
  117. );
  118. tgmpa( $plugins, $config );
  119. }