A plugin that allows you to easily create custom blocks with WordPress block editor [Block Lab]

It’s been a while since WordPress changed from a classic editor to a block editor. I didn’t get used to it at first, but once I used it, I was able to create a crisp screen, which is convenient!!!

Some people still want to include the classic editor plugin, but I personally prefer the block editor to the classic editor that generates mysterious tags or switches between visuals and text to break the layout.

The block editor is convenient because it also provides blocks that align columns and images and text side-by-side, but it is still difficult to match the design perfectly, so in such cases, I create a custom block with this plugin.

https://ja.wordpress.org/plugins/block-lab/

It is convenient to make it possible to enter questions and answers in custom blocks such as the [Frequently Asked Questions] page and make them one block!

After installing the plugin, click [Block Lab] → [Add New].

Enter a name for the block and add the fields you want to add.

The titles are [FAQ], [Q], and [A], and text fields have been added respectively.

On the right side, you can also select the icon and category to call on the edit screen.

When you click [Publish], the path will be displayed, so create a [block] directory in the theme file as it is and create a block-FAQ .php file.

To retrieve what you are typing, use tags such as block_field(), get_block_field().

For example, when creating the contents of a FAQ with a dd tag, the description will be as follows.

<dd class="faq">
 <dt>Q:<?php block_field('q') ?></dt>
 <dd>A:<?php block_field('a') ?></dd>
</dd>

Set the contents of the block-FAQ.php as shown above and call the FAQ block on the post screen.

Search for it and it will come up immediately!

When you select a block, an input field appears.

If you enter it here and post it, it will be displayed in the HTML as before.

It’s very easy to reflect the design you want、、!

It is also recommended when existing blocks are not enough.

コメントを残す

メールアドレスが公開されることはありません。

CAPTCHA


top