admin管理员组文章数量:1391974
custom post template design with dropdown option Hi problem is after I design a post with GUTENBERG how can I save this as a post template to reuse for future post ?
custom post template design with dropdown option Hi problem is after I design a post with GUTENBERG how can I save this as a post template to reuse for future post ?
Share Improve this question asked Feb 18, 2020 at 19:28 learning wordpresslearning wordpress 11 Answer
Reset to default 0To make a template that appears in the specific dropdown menu you're referencing, you need to create a file in the theme (or child theme). Let's say you're creating "tpl-events.php". Inside the file you'll add comments at the top:
<?php
/*
* Template Name: Events
*/
?>
The template will then appear in any post type that allows custom templates. If you'd like to specifically allow the template to be used in a CPT, you can add another comment:
<?php
/*
* Template Name: Events
* Template Post Type: page, event
*/
?>
If you're instead wanting to create a template of blocks to use on a page, you can either:
Create a reusable block - group all of your blocks in a single Group block and use the three-dot menu to select the Reusable Blocks option.
or
Set up a CPT template - if you'd like to have empty blocks added whenever you create a new post of a certain type, you can set this up either where the post type is registered or else add a filter.
本文标签: custom post template design with dropdown option
版权声明:本文标题:custom post template design with dropdown option 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744738026a2622446.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论