Import Menus 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.
Import menu items and assign them to menus #
Use this config/onboarding.php
format to create and assign menu items:
<?php
/**
* Genesis Sample.
*
* Onboarding config to load content and navigation on theme activation.
*
* @package Genesis Sample
* @author StudioPress
* @license GPL-2.0-or-later
* @link https://www.studiopress.com/
*/
return [
'dependencies' => [],
'widgets' => [],
// Full content omitted for this example leaving only keys.
'content' => [
'homepage' => [],
'about' => [],
'contact' => [],
'blocks' => [],
'landing' => [],
],
'navigation_menus' => [
'primary' => [
'homepage' => [
'title' => 'Home',
],
'about' => [
'title' => 'About Us',
],
'contact' => [
'title' => 'Contact Us',
],
'blocks' => [
'title' => 'Block Examples',
],
'landing' => [
'title' => 'Landing Page',
],
],
],
];
The keys in the navigation_menus
array should match those from imported content.
The primary
key above denotes that menu items should be assigned to the menu area that was registered as primary
via register_nav_menus()
.
Importing links as bare URLs is not currently supported.