【发布时间】:2021-06-15 18:58:20
【问题描述】:
首先我使用 acf 来创建古腾堡块(我认为这很重要)。
我为我的餐厅菜单制作了自定义帖子类型,我想为每个菜单强制使用完全相同的布局 帖子。 我做了背景块可以在里面添加块。
<div class="background">
<div class="background-color" style="background-color: <?php echo $background ?>"></div>
<InnerBlocks />
</div>
为了获得与每个帖子相似的布局,我在我的 cpt 中设置了模板参数
'template_lock' => 'all',
'template' => [
['acf/background', ['className' => 'meal_description', 'data' => ['admin_section_name' => 'Meal description']], [
['core/paragraph', ['align' => 'center', 'placeholder' => __('Your block there', 'restaurant')]],
]],
];
不幸的是,当我将 template_lock 设置为 all 时,我无法在名为 background 的“inner_blocks”中添加块。 我正在寻找管理员只能在预定义的块中添加一些块的解决方案。
【问题讨论】:
标签: wordpress wordpress-gutenberg