Install Dependencies During Genesis Theme Setup
Requires Genesis 2.9.0+ and WordPress 5.0.0+
One-click theme setup #
- Theme setup introduction.
- See full onboarding examples.
- Install plugins.
- Import content.
- Set up navigation.
- Import widgets.
- Run code.
- Create Starter Packs.
- Update theme settings.
Install plugins #
Plugins you add as dependencies are installed and activated before content is imported.
Only plugins from the WordPress.org repository are currently supported.
Add plugins as dependencies to your onboarding config like this:
<?php
/**
* Genesis Sample.
*
* Onboarding config to load plugins and homepage content on theme activation.
*
* @package Genesis Sample
* @author StudioPress
* @license GPL-2.0-or-later
* @link https://www.studiopress.com/
*/
return [
'dependencies' => [
'plugins' => [
[
'name' => __( 'Genesis Blocks', 'genesis-sample' ),
'slug' => 'genesis-blocks/genesis-blocks.php',
'public_url' => 'https://developer.wpengine.com/genesis-blocks/',
],
[
'name' => __( 'WPForms Lite', 'genesis-sample' ),
'slug' => 'wpforms-lite/wpforms.php',
'public_url' => 'https://wordpress.org/plugins/wpforms-lite/',
],
[
'name' => __( 'Genesis eNews Extended', 'genesis-sample' ),
'slug' => 'genesis-enews-extended/plugin.php',
'public_url' => 'https://wordpress.org/plugins/genesis-enews-extended/',
],
[
'name' => __( 'Simple Social Icons', 'genesis-sample' ),
'slug' => 'simple-social-icons/simple-social-icons.php',
'public_url' => 'https://wordpress.org/plugins/simple-social-icons/',
],
],
],
// Other config removed for this example.
'content' => [],
'navigation_menus' => [],
'widgets' => [],
];
- The plugin
slug
is the basename for the plugin's main PHP file. This is the plugin folder name (if the plugin has a folder), a forward slash, and then the name of the PHP file containing the plugin header. It's the value returned by addingvar_dump( plugin_basename( __FILE__ ) );
to the PHP file that contains the plugin header. - Users can skip the onboarding process, so you should still check for plugin dependencies. If your theme uses plugin-specific code, check for plugin classes and functions before using them with
class_exists()
orfunction_exists()
. - If a site already has one of your dependencies installed, it will be activated but not upgraded if a new plugin version is available. Updating plugins is left to the user to prevent possible conflicts with their existing content. If your theme depends on functionality from a specific plugin version, check for that functionality using
function_exists()
orclass_exists()
, or check the plugin version in your code.