admin管理员组

文章数量:1122832

I modified a theme so that the text on the front end is where I want it. The back end text in the editor is appearing smaller than the front end. I was able to find a setting under the .editor-styles-wrapper for --font-size-base where it was at 15px, and if I modified it in my inspector to 18px, that matches the front end the way I want it to when using the post editor.

The problem is I do not know where or how I need to set this to make it permanent with the theme. The back end is picking up the fonts from my front end, no problem, but I'd like to make sure the font-size setting is kept. Can I add this in the functions.php section under Appearance > Site Editor with some PHP and styling? I'm running on Mai Delight which runs on Genesis, if that gives any clues to people. Thanks for any advice!

I modified a theme so that the text on the front end is where I want it. The back end text in the editor is appearing smaller than the front end. I was able to find a setting under the .editor-styles-wrapper for --font-size-base where it was at 15px, and if I modified it in my inspector to 18px, that matches the front end the way I want it to when using the post editor.

The problem is I do not know where or how I need to set this to make it permanent with the theme. The back end is picking up the fonts from my front end, no problem, but I'd like to make sure the font-size setting is kept. Can I add this in the functions.php section under Appearance > Site Editor with some PHP and styling? I'm running on Mai Delight which runs on Genesis, if that gives any clues to people. Thanks for any advice!

Share Improve this question edited Jul 13, 2024 at 11:03 cjbj 15k16 gold badges42 silver badges89 bronze badges asked Jul 13, 2024 at 0:39 David BorrinkDavid Borrink 234 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Without knowing your exact setup, this is hard to say, but it looks like some code is adding styling that overrules some parts of your theme's styles. You could try adding !important to that font size and see what happens.

Otherwise, you could copy that line that works in the inspector into your theme's functions.php like this:

add_action('admin_head', 'wpse426010_custom_admin_styles', 999);
function wpse426010_custom_admin_styles() {
  echo '<style>
    ... your style here
   </style>';
}

Note the high priority of the function to make sure this style is added after everything else.

Beware that this hack will be specific to your current setup. Because it is likely the unintended consequence of some code, it could stop working when that code (Mai Delight, Genesis or some plugin) is updated.

本文标签: admin cssHow do I modify the fontsizebase used on editorstyleswrapper on the back end