LokusWP

Your WordPress Navigator

How to Build a Custom Block for Gutenberg

We can create 2 type of Custom Block

Static Block if that no need data or logic php need, like countdown, it’s all javascript code

Dynamic Block if you want need to get_current_id, get_current_user, ned php conditional logic, need session, this require javascript and php, or i’t SSR type


Dynamic Blocks

npx @wordpress/create-block@latest --namespace="my-plugin" --variant="dynamic"