{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "preferredVersions": {
    "php": "8.2",
    "wp": "6.7"
  },
  "landingPage": "/wp-admin/edit.php",
  "steps": [
    {
      "step": "login",
      "username": "admin"
    },
    {
      "step": "installPlugin",
      "pluginData": {
        "resource": "wordpress.org/plugins",
        "slug": "rb-thumbnail-columns" 
      },
      "options": {
        "activate": true
      }
    },
    {
      "step": "mkdir",
      "path": "/wp-content/uploads"
    },
    {
      "step": "runPHP",
      "code": "<?php \n// Create a sample post with a featured image for a good demo.\n$post_id = wp_insert_post([\n    'post_title' => 'Sample Post with Thumbnail',\n    'post_content' => 'This is a sample post content.',\n    'post_status' => 'publish',\n    'post_type' => 'post'\n]);\n\nif ($post_id) {\n    // A simple 1x1 base64 encoded transparent GIF/PNG image as placeholder\n    $base64_image = 'iVBORw0KGgoAAAANSUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';\n    $img_data = base64_decode($base64_image);\n    $filename = 'placeholder-thumb.png';\n    $filetype = 'image/png';\n    $upload_dir = wp_upload_dir();\n\n    if (wp_mkdir_p($upload_dir['path'])) {\n        $file = $upload_dir['path'] . '/' . $filename;\n    } else {\n        $file = $upload_dir['basedir'] . '/' . $filename;\n    }\n\n    file_put_contents($file, $img_data);\n\n    $attachment = [\n        'guid'           => $upload_dir['url'] . '/' . $filename,\n        'post_mime_type' => $filetype,\n        'post_title'     => preg_replace( '/\\.[^.]+$/', '', $filename ),\n        'post_content'   => '',\n        'post_status'    => 'inherit'\n    ];\n\n    $attach_id = wp_insert_attachment( $attachment, $file, $post_id );\n    require_once( ABSPATH . 'wp-admin/includes/image.php' );\n    $attach_data = wp_generate_attachment_metadata( $attach_id, $file );\n    wp_update_attachment_metadata( $attach_id, $attach_data );\n\n    set_post_thumbnail( $post_id, $attach_id );\n    \n    // Add a second post without a thumbnail for contrast\n    wp_insert_post([\n        'post_title' => 'Post Without Thumbnail',\n        'post_content' => 'This post has no featured image.',\n        'post_status' => 'publish',\n        'post_type' => 'post'\n    ]);\n}"
    }
  ]
}