WordPress Gutenberg Columns block

How can I copy the "Columns" block from the core Gutenberg blocks? I need to use bootstrap column grid on the

How can I copy the "Columns" block from the core Gutenberg blocks? I need to use bootstrap column grid on the front end, but I don't know how to replicate the "Columns" block. Where can I find it's source code?

How can I copy the "Columns" block from the core Gutenberg blocks? I need to use bootstrap column grid on the front end, but I don't know how to replicate the "Columns" block. Where can I find it's source code?

Share Improve this question asked May 28, 2019 at 11:37 Razvan CuceuRazvan Cuceu 2482 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

All of the WP 5.x Core blocks are in a file called block-library.js. However, because the blocks all require a build step, you won't be able to just copy the JS and start making edits. You'll need to have Node.js and NPM installed.

So, to get this all set up:

  1. Go to the Node JS website and install Node, which will also install NPM.

  2. From a command prompt (Terminal on MacOS, or Git Bash on Windows, or any other prompt of your choice), go to a directory where you want to download a copy of WP, and run git clone https://github/WordPress/wordpress-develop

  3. cd wordpress-develop and run git checkout 5.0 to get to the 5.0 branch (or adjust to whichever branch you want to work from, perhaps 5.2).

  4. From the same directory run npm install which will download all the dependencies.

  5. You can now go into /wordpress-develop/node_modules/@wordpress/block-library/src/columns/column.js to view the source for the Columns block. I have personally found that the way Core blocks are registered is so abstracted and so different from the examples of registering your own block, though, that it's been easier to work from tutorials and build a completely new block rather than copy from Core.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745412123a4626581.html

相关推荐

  • WordPress Gutenberg Columns block

    How can I copy the "Columns" block from the core Gutenberg blocks? I need to use bootstrap column grid on the

    4小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信