admin管理员组文章数量:1403438
I am developing a block theme.
parts/sidebar.html templates/index.html
Sidebar Template is include like this —
parts/sidebar.html has this HTML —
<!-- wp:group {"className":"sidebar"} -->
<div class="wp-block-group sidebar"></div>
<!-- /wp:group -->
I am new to Block Theme Development and I am completely Clueles how to make inside of this area: <div class="wp-block-group sidebar"></div>
block ready, which means "+" sign should appear while editing template.
I am developing a block theme.
parts/sidebar.html templates/index.html
Sidebar Template is include like this —
parts/sidebar.html has this HTML —
<!-- wp:group {"className":"sidebar"} -->
<div class="wp-block-group sidebar"></div>
<!-- /wp:group -->
I am new to Block Theme Development and I am completely Clueles how to make inside of this area: <div class="wp-block-group sidebar"></div>
block ready, which means "+" sign should appear while editing template.
1 Answer
Reset to default 1There are two steps to adding a template part.
- Define it in theme.json.
You should already have something similar to this:
"templateParts": [
{"area": "header", "name": "header", "title": "Header"},
{"area": "footer", "name": "footer", "title": "Footer"}
]
Just add another line for the sidebar:
"templateParts": [
{"area": "header", "name": "header", "title": "Header"},
{"area": "footer", "name": "footer", "title": "Footer"},
{"area": "sidebar", "name": "sidebar", "title": "Sidebar"}
]
- Add the file for the default block content.
This is the part you've done already - created parts/sidebar.html
.
With both pieces in place, when you go to Appearance > Editor, choose Patterns, and then choose All template parts, you should now see your sidebar. (If not, either clear your cache or do a hard refresh.) Edit it and you'll be able to add blocks inside the group you've defined.
本文标签: How to Make an area in BlockTheme Block Insertable
版权声明:本文标题:How to Make an area in BlockTheme Block Insertable? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744338035a2601308.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论