TGM Plugin Activation
Info
Official site http://tgmpluginactivation.com/configuration/
File Structure
theme/
├── inc/
│ └── tgmpa/
│ ├── class-tgm-plugin-activation.php
│ └── plugin-activation.php
└── functions.php
Step 1: Include php files
Include this code to functions.php file
/** * Theme Init */ require_once get_theme_file_path( '/inc/init.php' );
Include this code to /inc/init.php file
/** * TGM Plugin Activation */ require_once get_theme_file_path( '/inc/tgmpa/plugin-activation.php' );
Step 2: Register the required plugins for this theme
All exist options
$plugins = array( // This is an example of how to include a plugin bundled with a theme. array( 'name' => 'TGM Example Plugin', // The plugin name. 'slug' => 'tgm-example-plugin', // The plugin slug (typically the folder name).'source' => get_template_directory().'/plugins/arser-addons.zip','source' => get_template_directory().'/plugins/arser-addons.zip', 'source' => get_stylesheet_directory() . '/plugins/tgm-example-plugin.zip', // The plugin source. 'required' => true, // If false, the plugin is only 'recommended' instead of required. 'version' => '1.0.1', 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins. 'external_url' => '', // If set, overrides default API URL and points to an external URL. 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active. ), );
Register Some Popular Plugins
$plugins = array( // BootWP Addons array( 'name' => 'BootWP Addons', 'slug' => 'bootwp-addons', 'source' => 'https://theme.bootwp.com/wp-content/plugins/bootwp-addons.1.0.0.zip', // 'source' => get_template_directory().'/plugins/bootwp-addons.zip', 'version' => '1.0.0', ), // Redux Framework, theme options array( 'name' => 'Redux Framework', 'slug' => 'redux-framework', ), // Elementor, page builder array( 'name' => 'Elementor', 'slug' => 'elementor', ), // WPBakery Page Builder array( 'name' => 'WPBakery Page Builder', 'slug' => 'js_composer', 'source' => 'https://theme.bootwp.com/wp-content/plugins/js_composer.6.1.1.zip', 'required' => false, 'version' => '6.1.1', ), // Contact Form 7 array( 'name' => 'Contact Form 7', 'slug' => 'contact-form-7', ), // One Click Demo Import array( 'name' => 'One Click Demo Import', 'slug' => 'one-click-demo-import', ), // Advanced Custom Fields Pro array( 'name' => 'Advanced Custom Fields PRO', 'slug' => 'advanced-custom-fields-pro', 'source' => 'https://theme.bootwp.com/wp-content/plugins/advanced-custom-fields-pro.5.8.3.zip', 'version' => '5.8.3', ), // Slider Revolution array( 'name' => 'Slider Revolution', 'slug' => 'revslider', 'source' => 'http://wp.berserk.nikadevs.com/wp-content/uploads/plugin_archives/revslider.zip', 'required' => false, 'version' => '6.1.4', ), // WooCommerce array( 'name' => 'WooCommerce', 'slug' => 'woocommerce', 'required' => false, ), );