ブループリント 例
ヒント
Blueprints ギャラリー をチェックして、WordPress Playground を使用してさまざまな設定で WordPress サイトを起動する実際のコード例を確認してください。
ブループリントで実現できるクールな機能をいくつか見てみましょう。
テーマとプラグインをインストールする
{
"steps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "coblocks"
}
},
{
"step": "installTheme",
"themeData": {
"resource": "wordpress.org/themes",
"slug": "pendant"
}
}
]
}
カスタム PHP コードを実行する
{
"steps": [
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; wp_insert_post(array( 'post_title' => 'Post title', 'post_content' => 'Post content', 'post_status' => 'publish', 'post_author' => 1 )); "
}
]
}
Gutenberg 実験ページでオプションを有効にする
ここで、「新しい管理者ビュー」機能をオンにします。
{
"steps": [
{
"step": "runPHP",
"code": "<?php require '/wordpress/wp-load.php'; update_option( 'gutenberg-experiments', array( 'gutenberg-dataviews' => true ) );"
}
]
}
製品デモを紹介
{
"steps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "url",
"url": "https://your-site.com/your-plugin.zip"
}
},
{
"step": "installTheme",
"themeData": {
"resource": "url",
"url": "https://your-site.com/your-theme.zip"
}
},
{
"step": "importWxr",
"file": {
"resource": "url",
"url": "https://your-site.com/starter-content.wxr"
}
},
{
"step": "setSiteOptions",
"options": {
"some_required_option_1": "your_favorite_values",
"some_required_option_2": "your_favorite_values"
}
}
]
}