การสร้างเวิร์ดเพรสกูเทนเบิร์กบล๊อกไว้สร้างเนื้อหาง่าย ๆ
- เตรียมตัวโดยเซ็ตสภาพแวดล้อมให้ครบก่อน ( editor, NodeJs, npm, npx, servers )
- ติดตั้ง package เพิ่ม
npm -g install @wordpress/env - เปิด command ที่ WordPress plugins เช่น
cd /var/www/WordPress/wp-content/plugins - สร้างปลั๊กอินโดยคำสั่ง
npx @wordpress/create-block@latest { plugin name }
เช่นnpx @wordpress/create-block@latest rm-link
หรือnpx @wordpress/create-block@latest rm-link --variant="dynamic" - เปลี่ยน command ไปที่ปลั๊กอินที่สร้าง เช่น
cd rm-link - แก้
package.jsonใน folder เช่น ชื่อปล๊กอิน - ใช้คำสั่ง
npm run start - เข้าไปที่ http://localhost/WordPress/wp-admin/plugins.php แล้ว Activate plugin ของเรา
- สร้าง post ใหม่ตัวปลั๊กอินจะอยู่ในกลุ่ม Blocks > Widgets
- แก้ตัว plugin ให้สมบูรณ์
อ่านเพิ่มเติม
About the author