Changeset 3390943
- Timestamp:
- 11/06/2025 09:30:31 AM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
responsive-picture-block/assets/blueprints/blueprint.json
r3370243 r3390943 1 1 { 2 "landingPage": "/wp-admin/index.php", 2 "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 "landingPage": "/responsive-picture-block/", 3 4 "preferredVersions": { 4 "php": "8. 1",5 "php": "8.2", 5 6 "wp": "latest" 6 7 }, 7 " features": {8 " networking": true9 },8 "phpExtensionBundles": [ 9 "kitchen-sink" 10 ], 10 11 "steps": [ 11 12 { 13 "step": "setSiteOptions", 14 "options": { 15 "blogname": "Responsive Picture Block Demo" 16 } 17 }, 18 { 12 19 "step": "login", 13 "username": "admin" 20 "username": "admin", 21 "password": "password" 14 22 }, 15 23 { … … 17 25 "pluginData": { 18 26 "resource": "wordpress.org/plugins", 19 "slug": "contact-form-7.5.9.zip" 20 } 21 }, 22 { 23 "step": "installPlugin", 24 "pluginData": { 25 "resource": "wordpress.org/plugins", 26 "slug": "easy-updates-menu" 27 "slug": "responsive-picture-block" 28 }, 29 "options": { 30 "activate": true 27 31 } 28 32 }, 29 33 { 30 34 "step": "mkdir", 31 "path": " wordpress/wp-content/mu-plugins"35 "path": "/wordpress/wp-content/uploads/2025/11" 32 36 }, 33 37 { 34 38 "step": "writeFile", 35 "path": "wordpress/wp-content/mu-plugins/show-admin-notice-2.php", 36 "data": "<?php\nadd_action(\n'admin_notices',\nfunction() {\n$dismissed = get_user_option( 'dismissed_expose_blueprint_notice-2', get_current_user_id() );\nif ( $dismissed ) {\nreturn;\n}\necho '<div class=\"notice notice-success is-dismissible\" id=\"custom-admin-notice-2\"><p>' . esc_html( 'This is a demo of the \\'Easy Updates Menu\\' plugin, hover over the plugins menu on the left to see the new \\'Updates\\' menu item for quick access to plugin updates.' ) . '</p></div>';\n}\n);\nadd_action('wp_ajax_dismiss_custom-admin-notice-2', function() {\ncheck_ajax_referer('custom-admin-notice-2', 'nonce');\n$user_id = get_current_user_id();\nif ( $user_id ) {\nupdate_user_option($user_id, 'dismissed_expose_blueprint_notice-2', 1, false);\nwp_send_json_success();\n} else {\nwp_send_json_error('User not found');\n}\n} );\nadd_action('admin_footer', function() {\n?>\n<script type=\"text/javascript\">\njQuery(document).ready( function($) {\nvar ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>';\nvar nonce = '<?php echo esc_html( wp_create_nonce( 'custom-admin-notice-2' ) ); ?>';\n$( '#custom-admin-notice-2' ).on( 'click', '.notice-dismiss', function() {\n$.ajax({\nurl: ajaxurl,\ntype: 'POST',\ndata: {\naction: 'dismiss_custom-admin-notice-2',\nnonce: nonce\n}\n});\n});\n});\n</script>\n<?php\n} );" 39 "path": "/wordpress/wp-content/uploads/2025/11/emilia-willberg-adEviDyBoEI-unsplash.webp", 40 "data": { 41 "resource": "url", 42 "url": "https://raw.githubusercontent.com/iwtw-richb/demo-content/refs/heads/main/emilia-willberg-adEviDyBoEI-unsplash.webp" 43 } 44 }, 45 { 46 "step": "writeFile", 47 "path": "/wordpress/wp-content/uploads/2025/11/steven-van-elk-wyPZrkpuyu4-unsplash.webp", 48 "data": { 49 "resource": "url", 50 "url": "https://raw.githubusercontent.com/iwtw-richb/demo-content/refs/heads/main/steven-van-elk-wyPZrkpuyu4-unsplash.webp" 51 } 52 }, 53 { 54 "step": "wp-cli", 55 "command": "wp media import /wordpress/wp-content/uploads/2025/11/emilia-willberg-adEviDyBoEI-unsplash.webp --porcelain" 56 }, 57 { 58 "step": "wp-cli", 59 "command": "wp media import /wordpress/wp-content/uploads/2025/11/steven-van-elk-wyPZrkpuyu4-unsplash.webp --porcelain" 60 }, 61 { 62 "step": "runPHP", 63 "code": "<?php require_once '/wordpress/wp-load.php'; $attachments = get_posts(['post_type' => 'attachment', 'post_status' => 'inherit', 'posts_per_page' => -1, 'orderby' => 'ID', 'order' => 'DESC']); $steven_id = null; $emilia_id = null; foreach ($attachments as $att) { $file = get_attached_file($att->ID); if (strpos($file, 'steven-van-elk') !== false) { $steven_id = $att->ID; } if (strpos($file, 'emilia-willberg') !== false) { $emilia_id = $att->ID; } if ($steven_id && $emilia_id) break; } if (!$steven_id || !$emilia_id) { echo 'Error: Could not find attachments'; exit; } $steven_src = wp_get_attachment_image_url($steven_id, 'large'); $emilia_src = wp_get_attachment_image_url($emilia_id, 'large'); if (!$steven_src || !$emilia_src) { echo 'Error: Could not get image URLs'; exit; } $content = '<!-- wp:spacer {\"height\":\"60px\"} -->' . \"\\n\" . '<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>' . \"\\n\" . '<!-- /wp:spacer -->' . \"\\n\\n\" . '<!-- wp:paragraph -->' . \"\\n\" . '<p>Preview this page in desktop and mobile mode to see the change of art direction based on device. <br><strong>Challenge</strong>: Try adding a tablet version or a landscape only version with a custom media query.</p>' . \"\\n\" . '<!-- /wp:paragraph -->' . \"\\n\\n\" . '<!-- wp:spacer {\"height\":\"60px\"} -->' . \"\\n\" . '<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>' . \"\\n\" . '<!-- /wp:spacer -->' . \"\\n\\n\" . '<!-- wp:ce/responsive-picture -->' . \"\\n\" . '<!-- wp:image {\"id\":' . $steven_id . ',\"sizeSlug\":\"large\",\"linkDestination\":\"none\"} -->' . \"\\n\" . '<figure class=\"wp-block-image size-large\"><img src=\"' . esc_url($steven_src) . '\" alt=\"\" class=\"wp-image-' . $steven_id . '\"/></figure>' . \"\\n\" . '<!-- /wp:image -->' . \"\\n\\n\" . '<!-- wp:image {\"id\":' . $emilia_id . ',\"sizeSlug\":\"large\",\"linkDestination\":\"none\",\"ceViewport\":\"mobile\"} -->' . \"\\n\" . '<figure class=\"wp-block-image size-large\"><img src=\"' . esc_url($emilia_src) . '\" alt=\"\" class=\"wp-image-' . $emilia_id . '\"/></figure>' . \"\\n\" . '<!-- /wp:image -->' . \"\\n\" . '<!-- /wp:ce/responsive-picture -->'; wp_insert_post(['post_title' => 'Responsive Picture Block Test', 'post_name' => 'responsive-picture-block', 'post_content' => $content, 'post_status' => 'publish', 'post_type' => 'page']); echo 'OK';" 37 64 } 38 65 ]
Note: See TracChangeset
for help on using the changeset viewer.