php CPT'食谱'编辑器中的默认模板块
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php CPT'食谱'编辑器中的默认模板块相关的知识,希望对你有一定的参考价值。
//add_action( 'init', 'set_default_RECIPE_blocks_template' );
//add_filter( 'register_post_type_args', 'set_default_RECIPE_blocks_template', 20, 2 );
add_filter( 'register_post_type_args', function( $args, $post_type ) {
if( 'recipe' === $post_type && is_array( $args ) ){
$args['template_lock'] = 'all';
$args['template'] = [
[
'wpzoom-recipe-card/block-recipe-card',[
'placeholder'=>'',
]
]
];
}
return $args;
}, 99, 2 );
/*
References:
* https://www.billerickson.net/gutenberg-block-templates/ - but was more for CORE PostTypes & as you register a CPT
* https://wp.zacgordon.com/2018/01/05/how-to-add-block-templates-to-your-wordpress-theme-or-plugin/ - set template after CPT was registered
*/
/* other blocks setting examples
[
// Example of including a core image block
// Optional alignment setting
'core/image', [
'align' => 'left',
]
],
[
// Example of including a core paragraph block
// Optional alignment placeholder setting
'core/paragraph', [
'placeholder' => 'The only thing you can add',
'align' => 'right',
]
],
[
// Example of including a core heading block
// Optional alignment placeholder setting
'core/heading', [
'placeholder' => 'TEST Author...',
'align' => 'left',
]
],
[
// Example of including a custom block
// Optional placeholder setting
'custom/your-blocks', [
'placeholder' => 'Custom placeholder',
]
]
*/
以上是关于php CPT'食谱'编辑器中的默认模板块的主要内容,如果未能解决你的问题,请参考以下文章
php 在“前端布局”列表中显示“自定义帖子类型”。 Upfront隐藏'产品'CPT,因为它依赖于电子商务插件,此过滤器将显示CPT i
easyUI 编辑器中的 下拉框默认选中问题!
OpsWorks 找不到我的 Chef 食谱
为啥 yocto 跳过我的食谱?
无法在 metadata.rb chef 中添加食谱依赖项
在 Rails 中实现将食谱添加到收藏夹并查找当前用户是不是有 'favorite_set?'一个食谱