From the course: WordPress: Introduction to Custom Block Building

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Creating a custom block with code

Creating a custom block with code

- We've gone through a lot of information on custom block building so far. We've learned how to create our own without code, display them, and even manipulate blocks created by others. We'll now get into creating our own custom block with code. First, let's generate a custom block that we will use as a template. Open your terminal and navigate to the folder of the website we created earlier in the course. I named mine pixelford-photography. From there, navigate to your site's plugin folder. The path is app, public, wp-content, and finally, plugins. In your plugins directory, we will be using the command npx @wordpress /create-block@latest. This command is called the Create Block Tool and will help us speed up and streamline the block building process. After latest in our command, we'll put in a space and then add photoshoot-themes. This will name the directory photoshoot themes and the block as well. So the full command…

Contents