If you clone this and
docker-compose up, the WordPress environment will start up in an instant.
It happened that I had to play with WordPress. Until now, in order to prepare the development environment, set up a MySQL server locally, create a DB, create and arrange around users and privileges, create a PHP environment, create a Web server environment, connect, check the operation .. I was doing my best to do what is called MAMP, but nowadays it is not normal, so I did a little research to build an environment with docker.
When I looked it up, there was a docker image called
wordpress, and of course there was also a docker image for
mysql, so I decided to make it with a good feeling,
As for how to make it, it was carefully written in Description of Docker Hub of
wordpress, so I will describe it as reference information.
In the middle of the page, the section "... via docker stack deploy or docker-compose" is almost the same.
This time I wanted to make a theme or plugin, so I created
docker-compose.yml to mount
wp-content / themes and
wp-content / plugins.
version: '3.1' services: wordpress: image: wordpress restart: always ports: - 8080:80 environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: exampleuser WORDPRESS_DB_PASSWORD: examplepass WORDPRESS_DB_NAME: exampledb volumes: - wordpress:/var/www/html - ./wp-content/themes:/var/www/html/wp-content/themes - ./wp-content/plugins:/var/www/html/wp-content/plugins db: image: mysql:5.7 restart: always environment: MYSQL_DATABASE: exampledb MYSQL_USER: exampleuser MYSQL_PASSWORD: examplepass MYSQL_RANDOM_ROOT_PASSWORD: '1' volumes: - db:/var/lib/mysql volumes: wordpress: db:
Now, when you open
docker-compose up and
http: // localhost: 8080, the WordPress setup screen will open immediately, so if you proceed as it is, you can go to the management screen.
From here onward, I just wrote it in the meantime, so I think it can only be used as a memorandum of my own.
When creating my own theme, I think that the layout and appearance are controlled by style.css, but since WordPress is a CMS equipped with a WYSIWYG editor, it is necessary to make use of the layout of the content part that is provided in WordPress.
The built-in style is described in the "WordPress Generated Classes" section of CSS «WordPress Codex. By copying and pasting this to the bottom of my own theme, I was able to reflect the layout specified at the time of editing with WYSIWYG on the actual display.
Initially, the style defined in my own style.css was applied to the elements of the content part, so there was a problem that it looked different from WYSIWYG, but probably the responsibility of markup as follows I feel that the demarcation will generally work.
--On the template / theme side, only the layout of the block element that wraps the content is controlled by HTML + CSS, and
<? Php the_content ();?> Does not affect the layout of the content body to be embedded`` I'll make it style.css
In short, the HTML that WordPress WYSIWYG spits out is unpredictable, so it's probably impossible to control block layout of the content body with your own css. Rather, I feel that the theme creator needs a class / selector design that allows the block layout of the content body to be left uncontrolled.
It was okay to make it support the color palette function, but this time I didn't need to create a general-purpose theme that fully supports WordPress functions, so I implemented it with minimal function support.