Easy way to get 15 free YouTube views, likes and subscribers
Get Free YouTube Subscribers, Views and Likes

How to Build Dynamic (PHP) Blocks in WordPress

Follow
Brian Coords - WordPress Dev

Let's build a dynamic block for WordPress. Along the way we'll discuss the difference between static and dynamic blocks, when to use them, WP_Query, what ServerSideRender is and what the best approach for performance is.

Free Video Series: 7 Tools for Modern WordPress Development
https://briancoords.com/7tools

Code Repository: https://github.com/bacoords/exampled...
Blog Post: https://www.briancoords.com/howtobu...

More Reading:
Rest API Handbook: https://developer.wordpress.org/rest...
Static vs Dynamic Rendering: https://developer.wordpress.org/block...
Static vs Dynamic Blocks: https://developer.wordpress.org/news/...

Chapters:
00:00:00 Dynamic vs Static Blocks
00:02:26 Scaffold with CreateBlock
00:03:36 Block Plugin Structure and Build Process
00:04:07 Block.json
00:07:03 Index.js
00:08:01 Edit.js Adding Inspector Controls
00:12:34 Render.php
00:16:26 Adding CSS in Style.scss
00:17:48 The ServerSideRender Component
00:22:10 Edit.js Building the block with coredata
00:25:32 Data from WP REST API vs WP_Query

posted by keisame0k