admin管理员组文章数量:1122832
Is there a setting in WordPress Gutenberg editor to change the font size of the text we type while writing posts? I mean the text size inside the editor itself, not the published text that blog visitors view.
Is there a setting in WordPress Gutenberg editor to change the font size of the text we type while writing posts? I mean the text size inside the editor itself, not the published text that blog visitors view.
Share Improve this question edited Dec 9, 2018 at 17:46 Muhammad asked Dec 8, 2018 at 6:40 MuhammadMuhammad 611 gold badge1 silver badge4 bronze badges 2- I've found what I was looking for. Here is the link to the solution in case someone is looking for this: paulchinmoy.com/change-gutenberg-editors-default-font – Muhammad Commented Dec 9, 2018 at 18:55
- Great question! As people age, smaller type becomes hard to see... – MikeSchinkel Commented Mar 22, 2019 at 16:38
4 Answers
Reset to default 8If you came here, like me, looking for how to adjust the available text size options within Gutenberg, you can add this code to your theme's functions.php
file (you can add as many options as you like):
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Normal', 'your-theme-text-domain' ),
'shortName' => __( 'N', 'your-theme-text-domain' ),
'size' => 14,
'slug' => 'normal'
),
array(
'name' => __( 'Medium', 'your-theme-text-domain' ),
'shortName' => __( 'M', 'your-theme-text-domain' ),
'size' => 16,
'slug' => 'medium'
)
)
);
This gives the following result within the Gutenberg editor:
You can add add_theme_support( 'disable-custom-font-sizes' );
to your functions.php
to remove the numerical input, although the "Custom" option will still be visible in the dropdown.
Just click on the settings/cog icon on the right hand side when you are editing paragraph. Then choose Block. You should then see the option to edit font size. You can choose from dropdown menu or type the font size you want.
Hope this helps. :)
When we change the paragraph font size in Gutenberg via the block text settings, it will be added inline like:
<p style="font-size:18px">Lorem Ipsum</p>
If we are frequently changing the font-size (or other formatting) like that, it's easy to imagine the state of the content in few years, where most of the content formatting is hard coded.
It could e.g. override the formatting from a new theme if we decide to switch to a new theme later on.
So I would suggest using it with care.
An alternative could be to target the formatting via unobtrusive CSS.
If that's not possible one could then consider adding custom target CSS classes via the Advanced Gutenberg block setting:
that will generate a class attribute like:
<p class="some__custom--class">Lorem Ipsum</p>
where we define the CSS class in the corresponding stylesheet.
I had same question how to change heading font size in Editor, just found myself:
PS: This is a generic solution for any WP customization:
- While in editor, using e.g. Firefox "inspect element", select the element(any text or heading) you want to change;
- In the middle column, it will point to the setting css file, e.g. editor-style.css, it gives also the line number;
- Go [SIDE MENU]Appearance => Theme Editor => select the css setting file, change the font size, and update the css setting file.
- That's it!
For your case, it is to change editor-blocks.css:
.edit-post-visual-editor .editor-block-list__block,
.edit-post-visual-editor .editor-block-list__block p,
.editor-default-block-appender textarea.editor-default-block-appender__content {
font-size: 16px; /* change to your font size */
}
本文标签: formattingHow to change text size of Gutenberg editor
版权声明:本文标题:formatting - How to change text size of Gutenberg editor 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736310756a1934492.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论