Creating a WordPress theme with Emacs

Emacs is useful for creating of WordPress themes. Learn about how to setup the environment.
Intruduction
How to get development environment for WordPress theme?
Requirements
This article assumes the following softwares on your hands.
- macOS Catalina (v10.15.7)
- Docker Desktop v3.1.0 (51484)
- Emacs
Setup WordPress on Docker
Now, let's prepare WordPress environment.
In this post, i use WordPress on Docker as a development environment.
A docker-compose.yml
which is tutorial level is sufficient to develop.
First, make a working directory.
|
|
Next, make a docker-compose.yml
.
|
|
Run this command.
|
|
Open http:localhost:8000 in your web browser, you get the following page.
Setup Emacs
Setup PHP environment on your Emacs.
First, install PHP to your Mac.
|
|
Next, check the version.
|
|
Next, setup to your Emacs.
- lsp-mode
- php-mode
- exec-path-from-shell
intelephense
is /usr/local/bin/intelephense
, so you provide $PATH
to your Emacs.
I know that two methods to provide the $Path to Emacs.
exec-path-from-shell
(recommended)- Parse $PATH on your original elisp
Use exec-path-from-shell
(recommended).
|
|
Or this.
|
|
Setting lsp-mode
|
|
Edit WordPress theme
Launch your Emacs. Then, let's try to open single.php
of twentytwentyone theme.
|
|
Include it in the activity range of lsp-mode with the following command
|
|
Then, kick lsp-mode this command.
|
|
Cleanup command is here:
|
|