Skip to content

Commit

Permalink
Improved documentation about including WP when running PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
janw-me committed Oct 6, 2023
1 parent 1af59f2 commit 5ff97f2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -61,7 +61,8 @@ You can connect to the Playground using the JavaScript client. Here's an example
});
const response = await client.run({
code: '<?php echo "Hi!"; ',
// wp-load.php is only required if you want to interact with WordPresss.
code: '<?php require_once "/wordpress/wp-load.php"; \$posts = get_posts(); echo "Post Title: " . \$posts[0]->post_title;',
});
console.log(response.text);
</script>
Expand Down
Expand Up @@ -73,7 +73,8 @@ You can also use Blueprints with the JavaScript API using the `startPlaygroundWe
});
const response = await client.run({
code: '<?php echo "Hi!"; ',
// wp-load.php is only required if you want to interact with WordPresss.
code: '<?php require_once "/wordpress/wp-load.php"; \$posts = get_posts(); echo "Post Title: " . \$posts[0]->post_title;',
});
console.log(response.text);
</script>
Expand Down
Expand Up @@ -10,7 +10,7 @@ import { fileToUint8Array } from './common';
* <code>
* {
* "step": "runPHP",
* "code": "<?php echo 'Hello World'; ?>"
* "code": "<?php require_once 'wordpress/wp-load.php'; wp_insert_post(array('post_title' => 'wp-load.php required for WP functionality', 'post_status' => 'publish')); ?>"
* }
* </code>
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/playground/client/README.md
Expand Up @@ -12,7 +12,8 @@ const client = await startPlaygroundWeb({
});

const response = await client.run({
code: '<?php echo "Hi!"; ',
// wp-load.php is only required if you want to interact with WordPresss.
code: '<?php require_once "/wordpress/wp-load.php"; \$posts = get_posts(); echo "Post Title: " . \$posts[0]->post_title;',
});
console.log(response.text);
```
Expand Down

0 comments on commit 5ff97f2

Please sign in to comment.