Skip to content

Commit 65b537e

Browse files
committed
docs: WordPress
1 parent 89c97fd commit 65b537e

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ Go to `https://localhost`, and enjoy!
140140
- [Create static binaries](https://frankenphp.dev/docs/static/)
141141
- [Compile from sources](https://frankenphp.dev/docs/compile/)
142142
- [Monitoring FrankenPHP](https://frankenphp.dev/docs/metrics/)
143+
- [WordPress integration](https://frankenphp.dev/docs/wordpress/)
143144
- [Laravel integration](https://frankenphp.dev/docs/laravel/)
144145
- [Known issues](https://frankenphp.dev/docs/known-issues/)
145146
- [Demo app (Symfony) and benchmarks](https://github.com/dunglas/frankenphp-demo)

docs/wordpress.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# WordPress
2+
3+
Run [WordPress](https://wordpress.org/) with FrankenPHP to enjoy a modern, high-performance stack with automatic HTTPS, HTTP/3, and Zstandard compression.
4+
5+
## Minimal Installation
6+
7+
1. [Download WordPress](https://wordpress.org/download/)
8+
2. Extract the zip archive and open a terminal in the extracted directory
9+
3. Run:
10+
```console
11+
frankenphp php-server
12+
```
13+
4. Go to `http://localhost/wp-admin/` and follow the installation instructions
14+
5. Enjoy!
15+
16+
For a production-ready setup, prefer using `frankenphp run` with a `Caddyfile` like this one:
17+
18+
```caddyfile
19+
example.com
20+
21+
php_server
22+
encode zstd br gzip
23+
log
24+
```
25+
26+
## Hot Reload
27+
28+
To use the [hot reload](hot-reload.md) feature with WordPress, enable [Mercure](mercure.md) and add the `hot_reload` sub-directive to the `php_server` directive in your `Caddyfile`:
29+
30+
```caddyfile
31+
localhost
32+
33+
mercure {
34+
anonymous
35+
}
36+
37+
php_server {
38+
hot_reload
39+
}
40+
```
41+
42+
Then, add the code needed to load the JavaScript libraries in the `functions.php` file of your WordPress theme:
43+
44+
```php
45+
function hot_reload() {
46+
?>
47+
<?php if (isset($_SERVER['FRANKENPHP_HOT_RELOAD'])): ?>
48+
<meta name="frankenphp-hot-reload:url" content="<?=$_SERVER['FRANKENPHP_HOT_RELOAD']?>">
49+
<script src="https://cdn.jsdelivr.net/npm/idiomorph"></script>
50+
<script src="https://cdn.jsdelivr.net/npm/frankenphp-hot-reload/+esm" type="module"></script>
51+
<?php endif ?>
52+
<?php
53+
}
54+
add_action('wp_head', 'hot_reload');
55+
```
56+
57+
Finally, run `frankenphp run` from the WordPress root directory.

0 commit comments

Comments
 (0)