[Resolved] State the best way to completely remove generate-style-inline-css

Home Forums Support [Resolved] State the best way to completely remove generate-style-inline-css

Home Forums Support State the best way to completely remove generate-style-inline-css

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #428224
    David

    Thanks.

    #428256
    Tom
    Lead Developer
    Lead Developer

    In GP version prior to 2.0:

    add_action( 'after_setup_theme', 'tu_remove_dynamic_css' );
    function tu_remove_dynamic_css() {
        remove_action( 'wp_enqueue_scripts', 'generate_color_scripts', 50 );
        remove_action( 'wp_enqueue_scripts', 'generate_spacing_scripts', 50 );
        remove_action( 'wp_enqueue_scripts', 'generate_typography_scripts', 50 );
        remove_action( 'wp_enqueue_scripts', 'generate_secondary_color_scripts', 80 );
        remove_action( 'wp_enqueue_scripts', 'generate_background_scripts', 70 );
    }

    In GP 2.0:

    add_action( 'after_setup_theme', 'tu_remove_dynamic_css' );
    function tu_remove_dynamic_css() {
        remove_action( 'wp_enqueue_scripts', 'generate_enqueue_dynamic_css', 50 );
    }
    #431469
    David

    Thanks!

    #431733
    Tom
    Lead Developer
    Lead Developer

    No problem 🙂

    #605890
    Rafał

    Hi!
    Have you noticed that still remains some stuff?

    <style id='generate-style-inline-css' type='text/css'>
    .main-navigation .navigation-logo img {height:60px;}@media (max-width: 1030px) {.main-navigation .navigation-logo.site-logo {margin-left:0;}body.sticky-menu-logo.nav-float-left .main-navigation .site-logo.navigation-logo {margin-right:0;}}.mobile-header-navigation .mobile-header-logo img {height:60px;}.main-navigation .main-nav ul li a,.menu-toggle,.main-navigation .mobile-bar-items a{transition: line-height 300ms ease}
    .slideout-navigation.main-navigation .main-nav ul li a{font-weight:normal;text-transform:none;}
    </style>
    #606195
    Tom
    Lead Developer
    Lead Developer

    Ah, that’s coming from the Menu Plus module and can’t be removed as easily.

    Another idea is to remove the core stylesheet in GP, and re-add it with a different ID:

    add_action( 'wp_enqueue_scripts', 'tu_rename_style', 20 );
    function tu_rename_style() {
        wp_dequeue_style( 'generate-style' );
        wp_enqueue_style( 'generate-custom-style', get_template_directory_uri() . "/style.min.css", array( 'generate-style-grid' ), GENERATE_VERSION, 'all' );
    }
    #607293
    Rafał

    does not remove inline CSS :/

    #607466
    Tom
    Lead Developer
    Lead Developer

    Can you link me to your site?

    BTW, I definitely don’t suggest that anyone do this. It will make it so all of the Customizer settings no longer work.

    If you don’t want inline CSS, I suggest using Autoptimize (https://wordpress.org/plugins/autoptimize/). It takes all of the inline CSS and caches it inside a file.

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