admin管理员组

文章数量:1305006

I need many "Reusable Blocks", but creating and maintaining them takes too long.

I'd like to do this:

  • create a PHP-based "template" file, e.g. wp-content/foo/bar.php
  • create a page in the block editor, and insert/include that "template"

Is that possible somehow?

I need many "Reusable Blocks", but creating and maintaining them takes too long.

I'd like to do this:

  • create a PHP-based "template" file, e.g. wp-content/foo/bar.php
  • create a page in the block editor, and insert/include that "template"

Is that possible somehow?

Share Improve this question asked Dec 15, 2019 at 6:07 lonixlonix 3011 silver badge10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Block Patterns probably will suit your needs. They're written in PHP, designed so you can create layouts (like a heading, gallery, and button together) but the content (e.g. what the text of the heading is, etc) is unique each time that you use them.

A good overview and roundup of how they're being used is at the Gutenberg Times.

本文标签: Use PHP templates as blocks