Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter stargayte

    (@stargayte)

    Hi thank you for your answer.

    This happens with the CSS minify yes.
    I was using the default one, but I tried all of them:
    – Minify (Default)
    – CSS tidy
    – YUI Compressor

    All my CSS are minified together, but are included as a stylesheet with media=”all” even if they have been registered as screen.

    	
    	wp_enqueue_style(
    		'mystyle',
    		get_template_directory_uri() . '/mystyle.css',
    		array(),
    		$version_number,
    		'screen'
    	);
    
    Thread Starter stargayte

    (@stargayte)

    It took me a while, but I finally found the bug in the plugin.

    It seems that WPFront Notification Bar is using the function get_option too early, it should wait for the plugins to be loaded before executing this function. The documentation explaining this here:
    https://polylang.pro/dont-take-any-action-before-plugins_loaded-is-fired/

    So I changed the wpfront-notification-bar.php file with :

    if(class_exists('\WPFront\Notification_Bar\WPFront_Notification_Bar') || class_exists('WPFront_Notification_Bar')) {
        return;
    }
    
    use WPFront\Notification_Bar\WPFront_Notification_Bar;
    
    function wpfront_notification_bar_init() {
      require_once("classes/class-wpfront-notification-bar.php");
    
      WPFront_Notification_Bar::Instance()->init(plugin_basename(__FILE__));
    }
    
    add_action('plugins_loaded', 'wpfront_notification_bar_init');
    

    And the translation is working like a charm now.
    It would be great to fix this, the fix is pretty easy just wrapping the execution of the plugin with the hook “plugins_loaded”.

    Same issue here, I checked the code there is some references to
    class_exists(‘acf’) when the ACF core is doing this class_exists(‘ACF’)

    But changing it doesn’t resolve the issue

    So add_editor_style seems to work indeed using this:

    function mytheme_editor_styles() {
    	add_theme_support( 'editor-styles' );
    	add_editor_style(get_template_directory_uri() . '/css/theme.css');
    }
    add_action( 'after_setup_theme', 'mytheme_editor_styles' );

    But how do you add Javascript to the iframe now? It doesn’t seem that there is a add_editor_script and when I read WordPress code/documentation, it says to use enqueue_block_editor_assets… So this is very confusing that this hook is not working anymore.

    Hello,

    I got the exact same issue. The update to wordpress 5.9 just broke the patterns preview feature. First I figured out that my styling added by enqueue_block_editor_assets was creating empty previews because of that rule:

    iframe {
      max-width: 100%
    }

    But now it looks like raw HTML rendering without any styling. It was working fine on WordPress 5.8 but for some reasons the styling is not applying inside the preview anymore.

    1. You’re correct. The editor styles loaded via enqueue_block_editor_assets won’t work in future WP version. It’s recommended to use add_editor_style for block editor styles as well.

    When I read the documentation of add_editor_style, it says that it is adding styles to TinyMCE. It doesn’t make any sense, the styles of the blocks should not be loaded into TinyMCE. Am I missing something?

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