简体   繁体   中英

How to use a Wordpress Gutenberg block programmatically into the theme?

I'm developing a wordpress theme 100% based on Gutenberg blocks. Some pages are built directly on the editor (eg. home page), but other pages (eg. search results) need to be coded.

I want to show my search results using a post grid block, for example.

Is it possible to call a Gutenberg block programmatically, ie, on my theme code, sending parameters and getting the html code back? As we do with do_shortcode() , for example?

It depends on the type of the block you are interested in, most of them are written and rendered entirely in JavaScript - have a look at the Block Editor Handbook and Dynamic Blocks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM