admin管理员组文章数量:1122832
I'm trying to understand how themes are constructed. One of the themes I've read has this in its templates/index.html:
<!-- wp:template-part {"slug":"header","theme":"themename","area":"header"} /-->
<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":
{"top":"40px","bottom":"40px","left":"var:preset|spacing|40","right":"var:preset|
spacing|40"}}},"layout":{"type":"constrained","contentSize":"100%"}} -->
<main
class="wp-block-group"
style="
padding-top: 40px;
padding-right: var(--wp--preset--spacing--40);
padding-bottom: 40px;
padding-left: var(--wp--preset--spacing--40);
">
<!-- wp:group {"style":{"spacing":{"padding":{"left":"0","right":"0"}}},"layout":
{"type":"constrained","contentSize":"1240px"}} -->
<div class="wp-block-group" style="padding-right: 0; padding-left: 0">
<!-- wp:columns -->
<div class="wp-block-columns">
(…)
So, this is somehow the same, but … twice? What is the point of doing this?
I'm trying to understand how themes are constructed. One of the themes I've read has this in its templates/index.html:
<!-- wp:template-part {"slug":"header","theme":"themename","area":"header"} /-->
<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":
{"top":"40px","bottom":"40px","left":"var:preset|spacing|40","right":"var:preset|
spacing|40"}}},"layout":{"type":"constrained","contentSize":"100%"}} -->
<main
class="wp-block-group"
style="
padding-top: 40px;
padding-right: var(--wp--preset--spacing--40);
padding-bottom: 40px;
padding-left: var(--wp--preset--spacing--40);
">
<!-- wp:group {"style":{"spacing":{"padding":{"left":"0","right":"0"}}},"layout":
{"type":"constrained","contentSize":"1240px"}} -->
<div class="wp-block-group" style="padding-right: 0; padding-left: 0">
<!-- wp:columns -->
<div class="wp-block-columns">
(…)
So, this is somehow the same, but … twice? What is the point of doing this?
Share Improve this question asked Aug 3, 2024 at 13:46 rhavinrhavin 1216 bronze badges1 Answer
Reset to default 3The <!-- wp:
tags are how the WordPress editor internal api control what has been generated on the page and it contains the data that is generated or controlled by the settings panel of the editor. In general, those settings are directly converted to some html / style that you see on the page but not always.
That's why it seems duplicated. One is for the editor internal control and the other is for the browser to display.
For more info about it, take a look at the Markup representation of a block of the Block Editor Handbook.
If you really want to understand it, I advise you to take a look at the technical overview introduction and the Key concepts from the Block Editor Handbook. The Handbook has a lot more of information and you should read it if you want a more in deep understanding of full site editing, blocks and block themes.
本文标签: themeswhat use have double styles in indexhtml
版权声明:本文标题:themes - what use have double styles in index.html? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299016a1930354.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论