Skip to content

Instantly share code, notes, and snippets.

@SirLouen
Last active November 27, 2025 23:20
Show Gist options
  • Select an option

  • Save SirLouen/25c154288850e1b5231bfc161c595f78 to your computer and use it in GitHub Desktop.

Select an option

Save SirLouen/25c154288850e1b5231bfc161c595f78 to your computer and use it in GitHub Desktop.
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"preferredVersions": {
"wp": "nightly",
"php": "8.3"
},
"features": {
"networking": true
},
"landingPage": "/wp-admin/edit.php",
"steps": [
{
"step": "login",
"username": "admin"
},
{
"step": "installTheme",
"themeData": {
"resource": "wordpress.org/themes",
"slug": "twentytwentyfive"
}
},
{
"step": "activateTheme",
"themeFolderName": "twentytwentyfive"
},
{
"step": "runPHP",
"code": "<?php\nrequire '/wordpress/wp-load.php';\n$theme_dir = WP_CONTENT_DIR . '/themes/twentytwentyfive';\n$global = [\n '$schema' => 'https://schemas.wp.org/trunk/theme.json',\n 'version' => 3,\n 'settings' => [\n 'spacing' => ['blockGap' => true],\n 'color' => ['background' => true]\n ],\n 'styles' => [\n 'spacing' => ['blockGap' => '50px'],\n 'color' => ['background' => '#00ff00']\n ]\n];\nfile_put_contents($theme_dir . '/theme.json', json_encode($global, JSON_PRETTY_PRINT));\n$styles_dir = $theme_dir . '/styles';\nif (!file_exists($styles_dir)) {\n mkdir($styles_dir);\n}\n$variation = [\n '$schema' => 'https://schemas.wp.org/trunk/theme.json',\n 'version' => 3,\n 'title' => 'No Block Gap',\n 'slug' => 'no-block-gap',\n 'blockTypes' => ['core/group'],\n 'styles' => [\n 'spacing' => ['blockGap' => '0'],\n 'color' => ['background' => '#ff0000']\n ]\n];\nfile_put_contents($styles_dir . '/no-block-gap.json', json_encode($variation, JSON_PRETTY_PRINT));\n$post_id = wp_insert_post([\n 'post_title' => 'Block Gap Test',\n 'post_content' => '<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Group without Style</h2>\n<!-- /wp:heading -->\n\n<!-- wp:group -->\n<div class=\"wp-block-group\"><!-- wp:paragraph -->\n<p>Paragraph 1</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Paragraph 2</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Group with Style</h2>\n<!-- /wp:heading --></div>\n<!-- /wp:group -->\n\n<!-- wp:group {\"className\":\"is-style-no-block-gap\"} -->\n<div class=\"wp-block-group is-style-no-block-gap\"><!-- wp:paragraph -->\n<p>Paragraph 1</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Paragraph 2</p>\n<!-- /wp:paragraph --></div>\n<!-- /wp:group -->',\n 'post_status' => 'draft',\n 'post_type' => 'post'\n]);\n?>"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment