Skip to content

Instantly share code, notes, and snippets.

@getdave
Last active January 30, 2026 14:43
Show Gist options
  • Select an option

  • Save getdave/bb626851c8de47edc583c172d901efee to your computer and use it in GitHub Desktop.

Select an option

Save getdave/bb626851c8de47edc583c172d901efee to your computer and use it in GitHub Desktop.
Navigation Block with Hash Links & Customizable Overlays Experiment
{
"meta": {
"title": "Navigation Block with Hash Links & Customizable Overlays Experiment",
"description": "Testing Navigation Block with Hash Links with Gutenberg Customizable Navigation Overlays experiment enabled",
"author": "automattic"
},
"landingPage": "/wp-admin/site-editor.php",
"steps": [
{
"step": "runPHP",
"code": "<?php\nrequire '/wordpress/wp-load.php';\n\n// Create pages for all navigation items\n$pages = array(\n array('title' => 'Home', 'slug' => 'home', 'content' => 'Welcome to our homepage.'),\n array('title' => 'About', 'slug' => 'about', 'content' => 'Learn more about us.'),\n array('title' => 'Projects', 'slug' => 'projects', 'content' => 'Explore our projects.'),\n array('title' => 'E-Commerce Platform', 'slug' => 'ecommerce-platform', 'content' => 'Details about our e-commerce platform project.', 'parent' => 'projects'),\n array('title' => 'Mobile App Redesign', 'slug' => 'mobile-app-redesign', 'content' => 'Details about our mobile app redesign project.', 'parent' => 'projects'),\n array('title' => 'Brand Identity System', 'slug' => 'brand-identity-system', 'content' => 'Details about our brand identity system project.', 'parent' => 'projects'),\n array('title' => 'Dashboard Analytics', 'slug' => 'dashboard-analytics', 'content' => 'Details about our dashboard analytics project.', 'parent' => 'projects'),\n array('title' => 'Content Management Tool', 'slug' => 'content-management-tool', 'content' => 'Details about our content management tool project.', 'parent' => 'projects'),\n array('title' => 'Contact', 'slug' => 'contact', 'content' => 'Get in touch with us.')\n);\n\n$parent_ids = array();\n\nforeach ($pages as $page_data) {\n $parent_id = 0;\n if (isset($page_data['parent'])) {\n $parent_id = $parent_ids[$page_data['parent']];\n }\n \n $page_id = wp_insert_post(array(\n 'post_type' => 'page',\n 'post_title' => $page_data['title'],\n 'post_name' => $page_data['slug'],\n 'post_content' => $page_data['content'],\n 'post_status' => 'publish',\n 'post_parent' => $parent_id\n ));\n \n $parent_ids[$page_data['slug']] = $page_id;\n}\n"
},
{
"step": "runPHP",
"code": "<?php\nrequire '/wordpress/wp-load.php';\n$experiments = get_option( 'gutenberg-experiments', array() );\n$experiments['gutenberg-customizable-navigation-overlays'] = true;\nupdate_option( 'gutenberg-experiments', $experiments );\n"
},
{
"step": "runPHP",
"code": "<?php\nrequire '/wordpress/wp-load.php';\n\n$post_content = '<!-- wp:navigation-link {\"label\":\"Home\",\"url\":\"/home\",\"kind\":\"custom\"} /--><!-- wp:navigation-link {\"label\":\"About\",\"url\":\"/about\",\"kind\":\"custom\"} /--><!-- wp:navigation-submenu {\"label\":\"Projects\",\"url\":\"/projects\",\"kind\":\"custom\"} --><!-- wp:navigation-link {\"label\":\"E-Commerce Platform\",\"url\":\"/projects/ecommerce-platform\",\"kind\":\"custom\"} /--><!-- wp:navigation-link {\"label\":\"Mobile App Redesign\",\"url\":\"/projects/mobile-app-redesign\",\"kind\":\"custom\"} /--><!-- wp:navigation-link {\"label\":\"Brand Identity System\",\"url\":\"/projects/brand-identity-system\",\"kind\":\"custom\"} /--><!-- wp:navigation-link {\"label\":\"Dashboard Analytics\",\"url\":\"/projects/dashboard-analytics\",\"kind\":\"custom\"} /--><!-- wp:navigation-link {\"label\":\"Content Management Tool\",\"url\":\"/projects/content-management-tool\",\"kind\":\"custom\"} /--><!-- /wp:navigation-submenu --><!-- wp:navigation-link {\"label\":\"Contact\",\"url\":\"/contact\",\"kind\":\"custom\"} /-->';\n\nwp_insert_post(array(\n 'post_type' => 'wp_navigation',\n 'post_title' => 'Test Navigation Menu',\n 'post_status' => 'publish',\n 'post_content' => $post_content\n));\n"
}
],
"preferredVersions": {
"php": "8.3",
"wp": "latest"
},
"features": {},
"login": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment