[Support request] add custom css to block editor incl. generate blocks

Home Forums Support [Support request] add custom css to block editor incl. generate blocks

Home Forums Support add custom css to block editor incl. generate blocks

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2357556
    Marco

    Hello
    I have some custom css in my GP child theme but I can’t figure out how to load it so it would also be used/applied in the Gutenberg editor / backend.

    Thank you in advance for your input.

    #2358043
    Ying
    Staff
    Customer Support

    Hi Marco,

    You can have this PHP snippet a try:

    add_action( 'after_setup_theme', function() {
        add_editor_style( 'url to your child theme CSS file' );
    } );
    #2358117
    Marco

    Thanks but doesn’t do the trick

    #2358132
    Ying
    Staff
    Customer Support

    Can you share the exact code you tried?

    #2358150
    Marco

    the stylesheet seems to be in there but the settings do not do anything to the layout in the backend – frontend is fine – I’m getting also an error in the safari console:

    SyntaxError: unexpected token ‘.’ (anonymous function) – style.min.css and this is how my file starts:

    .post-slides {
      margin-top: -40px;
      margin-bottom: 40px;
      position: relative;
      height: 520px;
    }
    #2358154
    Ying
    Staff
    Customer Support

    I mean what’s the php code you added, just want to check the file link is correct.

    #2358158
    Marco

    as I said, the file get loaded just fine I think:

    add_action( 'after_setup_theme', function() {
        add_editor_style( trailingslashit( get_stylesheet_directory_uri() ) . 'styles/css/style.min.css' );
    } );
    #2358161
    Ying
    Staff
    Customer Support

    If the file is loaded fine in the editor, the CSS should work.

    I just added your CSS to my child theme’s style.css file and the style was reflected in the editor right away.

    style.min.css looks like one of GP’s style sheets, are you sure the file URL is correct?

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.