• Resolved Karis

    (@askel45)


    Hi. How do you hook the theme’s editor styles? I tried to hook some I have in my custom plugin but they seem to also apply to the WP Admin menu and the block editor sidebar instead of just the content area itself.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    You’ll want to use this hook: https://developer.ww.wp.xz.cn/reference/hooks/enqueue_block_editor_assets/

    So you can do this:

    add_ation( 'enqueue_block_editor_assets', function() {
        wp_enqueue_style( 'your-handle', 'URL TO YOUR FILE' );
    } );
    Thread Starter Karis

    (@askel45)

    I don’t know why that code is not working. I have tried other multiple variations and none seems to work. My CSS is located inside a plugin folder like assets/css/editor-style.css. For the theme itself, only this code seems to work to enqueue my CSS on the frontend (but I cannot get the editor styles to work with it either). wp_enqueue_style( 'theme-style', plugins_url( '/assets/css/style.css', __FILE__ ) );

    Theme Author Tom

    (@edge22)

    When you view the source of the editor and search for your file, is the URL correct?

    Thread Starter Karis

    (@askel45)

    You are spot on! I had to include the full path to the URL.

    Theme Author Tom

    (@edge22)

    Awesome 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Block editor styles’ is closed to new replies.