• Resolved politicske

    (@politicske)


    Hello GP team! I am using a code to style the post title in the editor differently from the front end. But since WP 5.3, the class .editor-post-title__block .editor-post-title__input seems not to work anymore. Has this changed in the editor (WP itself) or the theme? I am using the 2.4 beta version.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Leo

    (@leohsiang)

    Hi there,

    Those are default classes in GP so sounds like something changed in WP 5.3.

    Can you link me to the page in question?

    Thread Starter politicske

    (@politicske)

    It is in the backend, so I can only give you some steps to replicate. Just set h1 in typography to uppercase and then use this code and see it does not work. Even tried on a test site.

    add_action( 'enqueue_block_editor_assets', function() {
        $css = '.editor-post-title__block .editor-post-title__input {text-transform: none;}';
    }, 100 );
    Leo

    (@leohsiang)

    Sorry are you trying to add CSS as a snippet?

    Does that code work for a twenty series WP theme?

    Thread Starter politicske

    (@politicske)

    Yes as a snippet. I tried 2020 theme and it seemed to work, though I am not sure if it is the code above or 2020 theme’s own style editor.

    Theme Author Tom

    (@edge22)

    Hi there,

    That function won’t work as is.

    Try this instead:

    add_action( 'enqueue_block_editor_assets', function() {
        $css = '.editor-post-title__block .editor-post-title__input {text-transform: none;}';
    
        wp_add_inline_style( 'generate-block-editor-styles', $css );
    }, 100 );
    Thread Starter politicske

    (@politicske)

    That code does not work either, Tom. It seems there have been some changes in WordPress 5.3.

    Theme Author Tom

    (@edge22)

    Can you try this?:

    add_action( 'enqueue_block_editor_assets', function() {
        $css = '.editor-post-title__block .editor-post-title__input {text-transform: none;}';
    
        wp_add_inline_style( 'generate-block-editor-styles', $css );
    }, 999 );

    Let me know ??

    Thread Starter politicske

    (@politicske)

    I found where the problem is. That code does not like being mixed with other $css codes after it (in WP 5.3). It works only as a standalone. Had to create a new snippet for the other codes.

    Theme Author Tom

    (@edge22)

    And it’s working now? ??

    Thread Starter politicske

    (@politicske)

    Yes. But I also had to adjust the priority for the other bunch (e.g. if I put 100 or 999 for both, the ones in the post body did not work). So I put like 999 for the title and 100 for the others.

    Theme Author Tom

    (@edge22)

    Glad you got it working ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Code not working’ is closed to new replies.