• Resolved humbertorobles

    (@humbertorobles)


    Hi there,
    I am trying to dequeue the generatepress style without success. I am using this:

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

    I still enqueue the GP style. Another solution for me it would be to enqueue the GP style before my styles. Is there any way to do it?
    Thanks a lot

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    what is you’re trying to do? Do you want your styles loading after the GP Styles? If so how are you adding them ?

    Thread Starter humbertorobles

    (@humbertorobles)

    I would like or remove the generatepress style or load my styles after the GP styles.
    I enqueued my styles with this function:

    add_action( 'wp_enqueue_scripts', 'hrd_enqueue_styles' );
    function hrd_enqueue_styles() {
    
        wp_enqueue_style( 'gp-child-style', get_stylesheet_directory_uri( ) . '/dist/index.css', array(), VERSION, 'all');
        wp_enqueue_style( 'swiper-css', 'https://unpkg.com/swiper@8/swiper-bundle.min.css', array(), '', 'all');
    
        wp_enqueue_script('jquery');
        wp_enqueue_script('fontawesome', 'https://kit.fontawesome.com/03d62932bb.js', array(), '', true);
        wp_enqueue_script('swiper-js', 'https://unpkg.com/swiper@8/swiper-bundle.min.js', array(), '', true);
        wp_enqueue_script('gp-child-js', get_stylesheet_directory_uri( ) . '/dist/index.js', array('jquery'), VERSION, true);
    }

    In the source code I obtain first my style (id=’gp-child-style-css’) and after GP style:

    <link rel='stylesheet' id='gp-child-style-css'  href='https://medical-house.local/wp-content/themes/generatepress-child/dist/index.css?ver=1' media='all' />
    <link rel='stylesheet' id='swiper-css-css'  href='https://unpkg.com/swiper@8/swiper-bundle.min.css?ver=6.0' media='all' />
    <link rel='stylesheet' id='generate-widget-areas-css'  href='https://medical-house.local/wp-content/themes/generatepress/assets/css/components/widget-areas.min.css?ver=3.1.3' media='all' />
    <link rel='stylesheet' id='generate-style-css'  href='https://medical-house.local/wp-content/themes/generatepress/assets/css/main.min.css?ver=3.1.3' media='all' />

    Hi @humbertorobles,

    Can you try adding a layer of priority to your Action Hook?

    For instance, modify this:

    add_action( 'wp_enqueue_scripts', 'hrd_enqueue_styles' );

    To this:

    add_action( 'wp_enqueue_scripts', 'hrd_enqueue_styles’, 500 );

    If that doesn’t work, try a higher value.

    Kindly let us know how it goes.

    Thread Starter humbertorobles

    (@humbertorobles)

    It works. Thank you

    You’re welcome @humbertorobles!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dequeue generate style’ is closed to new replies.