Adding editor styles to the Astra theme

257 views Asked by At

I'm using the Astra theme (with the Astra Pro plugin). I'm trying to enqueue some custom editor styles for some block patterns I have created. I tried this first: add_theme_support('editor-styles'); but the moment I did--before even getting to add_editor_style--some unfortunate things happened, e.g. the text in a default paragraph block displayed much smaller. I was able to use the add_editor_style() function, and could then correct the problem with the small font size, but that means a lot of extra work to do to correct any other styles that inadvertently affected by the add_theme_support('editor-styles) function . Any ideas what I'm doing wrong? Please note: I am running WP v6.0.1, Astra theme 3.9.0 (with a child theme), and Astra Pro v3.9.0. I'd be grateful for any suggestions or assistance!

1

There are 1 answers

0
Alan On

Here's the answer:

    wp_enqueue_style( 'tg-pattern-styles',  get_theme_file_uri( '/tg-pattern-styles.css' ) );
}
add_action( 'enqueue_block_assets', 'tg_block_styles' );```

It works for front and back end.