[Resolved] How to disable generate-style-inline-css?

Home Forums Support [Resolved] How to disable generate-style-inline-css?

Home Forums Support How to disable generate-style-inline-css?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1525631
    Mr Calvert

    Hello I have one question please help me!
    I see one style is <style id=’generate-style-inline-css’> in <head> how to remove that? I not want show css inline. I need at that to child theme!

    #1525834
    Elvin
    Staff
    Customer Support

    Hi,

    You can try adding this PHP snippet:

    add_action( 'wp_enqueue_scripts', 'generate_replace_inline_css', 100 );
    function generate_replace_inline_css() {
    	wp_dequeue_style( 'generate-style' );
    
    }

    Here’s how to add PHP – https://docs.generatepress.com/article/adding-php/

    A wise man once said:
    "Have you cleared your cache?"

    #1525838
    Mr Calvert

    Can you guide for me disable one by one all this? I not want disable all I only want code to disable one to one for test!
    1. <link rel=’stylesheet’ id=’generate-fonts-css’ href=’//fonts.googleapis.com/css?family=Oxygen:300,regular,700′ media=’all’ />
    2. <link rel=’stylesheet’ id=’wp-block-library-css’ href=’https://bongcuoi.com/wp-includes/css/dist/block-library/style.min.css?ver=5.5.3&#8242; media=’all’ />
    3. <link rel=’stylesheet’ id=’generateblocks-css’ href=’//bongcuoi.com/wp-content/uploads/generateblocks/style-123.css?ver=1604717855′ media=’all’ />
    4. <link rel=’stylesheet’ id=’generate-widget-areas-css’ href=’https://bongcuoi.com/wp-content/themes/generatepress/assets/css/components/widget-areas.min.css?ver=3.0.2&#8242; media=’all’ />
    5. <link rel=’stylesheet’ id=’generate-style-css’ href=’https://bongcuoi.com/wp-content/themes/generatepress/assets/css/main.min.css?ver=3.0.2&#8242; media=’all’ />
    6. <link rel=’stylesheet’ id=’generatepress-dynamic-css’ href=’//bongcuoi.com/wp-content/uploads/generatepress/style.min.css?ver=1605034639′ media=’all’ />

    #1525914
    Elvin
    Staff
    Customer Support

    Try these:

    add_action( 'wp_enqueue_scripts', 'generate_replace_inline_css', 100 );
    function generate_replace_inline_css() {
    wp_dequeue_style( 'generate-fonts' );
    wp_dequeue_style( 'wp-block-library' ); 
    wp_dequeue_style( 'generate-widget-areas' );
    wp_dequeue_style( 'generateblocks' );
    wp_dequeue_style( 'generate-style' );
    wp_dequeue_style( 'generatepress-dynamic' );
    }

    I don’t recommend removing wp-block-library & generateblocks as it is used by Gutenberg editor.

    A wise man once said:
    "Have you cleared your cache?"

    #1526253
    Mr Calvert

    I was try add but it not remove sir.
    https://bongcuoi.com
    Please check for me! I was add this code:
    add_action( ‘wp_enqueue_scripts’, ‘generate_replace_inline_css’, 100 );
    function generate_replace_inline_css() {
    wp_dequeue_style( ‘generate-style’ );
    }

    But when Ctrl+U I was see that exitent:
    <style id=’generate-style-inline-css’>
    .is-right-sidebar{width:30%;}.is-left-sidebar{width:30%;}.site-content .content-area{width:100%;}@media (max-width:768px){.main-navigation .menu-toggle,.sidebar-nav-mobile:not(#sticky-placeholder){display:block;}.main-navigation ul,.gen-sidebar-nav,.main-navigation:not(.slideout-navigation):not(.toggled) .main-nav > ul,.has-inline-mobile-toggle #site-navigation .inside-navigation > *:not(.navigation-search):not(.main-nav){display:none;}.nav-align-right .inside-navigation,.nav-align-center .inside-navigation{justify-content:space-between;}.has-inline-mobile-toggle .mobile-menu-control-wrapper{display:flex;flex-wrap:wrap;}.has-inline-mobile-toggle .inside-header{flex-direction:row;text-align:left;flex-wrap:wrap;}.has-inline-mobile-toggle .header-widget,.has-inline-mobile-toggle #site-navigation{flex-basis:100%;}.nav-float-left .has-inline-mobile-toggle #site-navigation{order:10;}}
    </style>

    #1526419
    David
    Staff
    Customer Support

    Hi there,

    why do you want to remove the generate-style-inline-css ? This is required by the theme to display the content correctly. Without it some elements will not be styled correctly.

    #1526530
    Mr Calvert

    I was add that css to childtheme please give me how to remove that?

    #1527072
    Leo
    Staff
    Customer Support

    You can add CSS to your child theme without removing that.

    #1527116
    Mr Calvert

    Can you give me code for remove that?

    #1527479
    Tom
    Lead Developer
    Lead Developer

    The code that Elvin shared should do it: https://generatepress.com/forums/topic/how-to-disable-generate-style-inline-css/#post-1525914

    However, it’s not a good idea – I don’t recommend doing this.

    What’s the difference between adding that CSS to your child theme vs. using the External File option in “Customize > General”. The latter will make it so you can continue to customize the theme without running into issues, and it will give you the same results that adding the CSS to your child theme will.

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