admin管理员组文章数量:1122846
Is it possible to "comment out" a block in wordpress when using the block editor?
I'm working on a wordpress site, and I want to temporarily make some of the wordpress blocks invisible to site visitors, but remain intact in the visual block editor, such that it could be easily toggled to be visible again.
I am a developer, so ordinarily I would just operate in the classic code editor. For example, if I had a paragraph:
<p>hello world</p>
Then I could simply "comment it out" as follows
<!-- temporarily disabled in 2024 for reasons -maltfield
<p>hello world</p>
-->
However, I'm designing this site for an organization that doesn't have any developers on-staff, so I want to do the equivalent of the above, but such that the block can be made visible/invisible entirely only using the visual block editor.
Is it possible to toggle the visibility of a wordpress block using only the visual block editor?
Is it possible to "comment out" a block in wordpress when using the block editor?
I'm working on a wordpress site, and I want to temporarily make some of the wordpress blocks invisible to site visitors, but remain intact in the visual block editor, such that it could be easily toggled to be visible again.
I am a developer, so ordinarily I would just operate in the classic code editor. For example, if I had a paragraph:
<p>hello world</p>
Then I could simply "comment it out" as follows
<!-- temporarily disabled in 2024 for reasons -maltfield
<p>hello world</p>
-->
However, I'm designing this site for an organization that doesn't have any developers on-staff, so I want to do the equivalent of the above, but such that the block can be made visible/invisible entirely only using the visual block editor.
Is it possible to toggle the visibility of a wordpress block using only the visual block editor?
Share Improve this question asked Aug 18, 2024 at 16:50 Michael AltfieldMichael Altfield 18015 bronze badges2 Answers
Reset to default 3If you have a "hidden" CSS class in your theme that hide blocks (like .hidden {display: none}
, you can add this class to your block in the editor using the "Advanced > Additional CSS class" control
- In the Block Editor, select the block you want to hide.
- Go to the "Advanced" section in the Block settings sidebar.
- Add a custom CSS class, like "hidden-block", to the "Additional CSS Class" field.
- Go to Tools > Theme File Editor from the wp-admin navigation.
- Add following style to the theme Stylesheet (style.css) and update.
body:not(.wp-admin) .hidden-block { display: none; }
本文标签: How to quotcomment outquot a block in Wordpress (make it invisible without deleting it)
版权声明:本文标题:How to "comment out" a block in Wordpress (make it invisible without deleting it)? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736297096a1929938.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论