1

I'm getting this error and not sure why. Here's my code :

$genesis_sample_shared_content = genesis_get_config( 'onboarding-shared' );

return [
    'starter_packs' => [
        'black-white' => [
            'title'       => __( 'Black & White', 'genesis-sample' ),
            'description' => __( 'A pack with a homepage designed with black and white images.', 'genesis-sample' ),
            'thumbnail'   => get_stylesheet_directory_uri() . '/config/import/images/thumbnails/home-black-white.jpg',
            'demo_url'    => 'https://demo.studiopress.com/genesis-sample/',
            'config'      => [
                'dependencies'     => [
                    'plugins' => $genesis_sample_shared_content['plugins'],
                ],
                'content'          => array_merge(
                    [
                        'homepage' => [
                            'post_title'     => 'Homepage',
                            'post_content'   => require dirname( __FILE__ ) . '/import/content/home-black-white.php',
                            'post_type'      => 'page',
                            'post_status'    => 'publish',
                            'comment_status' => 'closed',
                            'ping_status'    => 'closed',
                            'meta_input'     => [
                                '_genesis_layout'     => 'full-width-content',
                                '_genesis_hide_title' => true,
                                '_genesis_hide_breadcrumbs' => true,
                                '_genesis_hide_singular_image' => true,
                            ],
                        ],
                    ],
                    $genesis_sample_shared_content['content']
                ),
                'navigation_menus' => $genesis_sample_shared_content['navigation_menus'],
                'widgets'          => $genesis_sample_shared_content['widgets'],
            ],
        ],
    ],
];

I have modified the onboarding-shared.php file and remove the code for the content Maybe this is the problem?

Update : Now the menu items are created on theme setup. Here's the modified code :

return [
    'plugins'          => [
        [
            'name'       => __( 'Genesis Blocks', 'genesis-sample' ),
            'slug'       => 'genesis-blocks/genesis-blocks.php',
            'public_url' => 'https://wordpress.org/plugins/genesis-blocks/',
        ],
    ],
    'navigation_menus' => [
        'primary' => [
            'get-started'    => [
                'title' => 'Get Started',
            ],
            'testimonials'  => [
                'title' => 'Testimonials',
            ],
            'contact'       => [
                'title' => 'Contact Us',
            ],
        ],
    ],
    'widgets'          => [
        'footer-1' => [
            [
                'type' => 'text',
                'args' => [
                    'title'  => 'Design',
                    'text'   => '<p>With an emphasis on typography, white space, and mobile-optimized design, your website will look absolutely breathtaking.</p><p><a href="#">Learn more about design</a>.</p>',
                    'filter' => 1,
                    'visual' => 1,
                ],
            ],
        ],
        'footer-2' => [
            [
                'type' => 'text',
                'args' => [
                    'title'  => 'Content',
                    'text'   => '<p>Our team will teach you the art of writing audience-focused content that will help you achieve the success you truly deserve.</p><p><a href="#">Learn more about content</a>.</p>',
                    'filter' => 1,
                    'visual' => 1,
                ],
            ],
        ],
        'footer-3' => [
            [
                'type' => 'text',
                'args' => [
                    'title'  => 'Strategy',
                    'text'   => '<p>We help creative entrepreneurs build their digital business by focusing on three key elements of a successful online platform.</p><p><a href="#">Learn more about strategy</a>.</p>',
                    'filter' => 1,
                    'visual' => 1,
                ],
            ],
        ],
    ],
];

The menu items aren't for pages, they're linked to scroll points on the homepage. Not sure how to code that using the above PHP?

  • Does this answer your question? ["Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP](https://stackoverflow.com/questions/4261133/notice-undefined-variable-notice-undefined-index-warning-undefined-arr) – Jens Jan 03 '23 at 08:11
  • I removed this variable and it now works without error except the menu items aren't added $genesis_sample_shared_content['content']. I've updated the question with the code for the onboarding-shared.php which i may need to modify further. Thanks – Brett Stack 1 Jan 03 '23 at 08:23

1 Answers1

0

I removed $genesis_sample_shared_content['content'] and it now works except the menu items aren't created on theme setup maybe due to this error

Notice: Trying to get property 'name' of non-object in wp-admin/nav-menus.php on line 1098