Skip to content

Instantly share code, notes, and snippets.

@SirLouen
Last active December 10, 2025 23:31
Show Gist options
  • Select an option

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

Select an option

Save SirLouen/d388400bd778f147ff4f8bc67c929eb5 to your computer and use it in GitHub Desktop.
Testing for GB71448
{"landingPage":"/","steps":[{"step":"setSiteOptions","options":{"show_on_front":"page","page_on_front":3,"page_for_posts":4}},{"step":"writeFile","path":"/wordpress/wp-content/themes/twentytwentyfive/templates/page-homeposts.html","data":"<!-- wp:cover {\"dimRatio\":50,\"overlayColor\":\"base\",\"minHeight\":80,\"minHeightUnit\":\"vh\"} --><div class=\"wp-block-cover\" style=\"min-height:80vh\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-base-background-color has-background-dim\"></span><div class=\"wp-block-cover__inner-container\"><h1 class=\"wp-block-heading\">Latest Blog Posts</h1><p>Scroll down for featured posts</p></div></div><!-- /wp:cover --><!-- wp:query {\"perPage\":3} --><div class=\"wp-block-query\"><!-- wp:post-template --><!-- wp:post-featured-image {\"isLink\":true,\"width\":\"120px\",\"height\":\"120px\",\"scale\":\"cover\"} /--><!-- wp:post-title {\"isLink\":true} /--><!-- wp:post-excerpt /--><!-- wp:post-date /--><!-- /wp:post-template --><!-- wp:query-pagination /--></div><!-- /wp:query -->"},{"step":"runPHP","code":"<?php require_once '/wordpress/wp-load.php'; $post_id=wp_insert_post(array('post_title'=>'Sample Post','post_content'=>'<p>Sample post with featured image!</p>','post_status'=>'publish','post_type'=>'post')); $upload_dir=wp_upload_dir(); $image_path=$upload_dir['path'].'/featured.jpg'; $image_data=base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=='); file_put_contents($image_path,$image_data); $attachment=array('post_mime_type'=>'image/jpeg','post_title'=>'Featured','post_status'=>'inherit','guid'=>$upload_dir['url'].'/featured.jpg'); $attach_id=wp_insert_attachment($attachment,$image_path,$post_id); require_once(ABSPATH.'wp-admin/includes/image.php'); $attach_data=wp_generate_attachment_metadata($attach_id,$image_path); wp_update_attachment_metadata($attach_id,$attach_data); set_post_thumbnail($post_id,$attach_id); ?>"}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment