• Hello,

    I want to dequeue main.min.css file (id/handle is generate-style-css) but i can’t make it work with the normal way of doing it using dequeue/deregister.

    I think it is because child theme loads before parent so it is overrided.

    Here is what i used but doesn’t work:

    /* Dequeue generate style css parent main min css */
    add_action( 'wp_enqueue_scripts', 'remove_parent_style', 999999 );
    function remove_parent_style() {
        wp_dequeue_script( 'generate-style' );
        wp_deregister_script( 'generate-style' );
    }

    How can i dequeue this certain file from the parent generatepress theme?

    Thank you.

    • This topic was modified 2 years, 3 months ago by theotheo.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter theotheo

    (@theotheo)

    Hello?

    Hi there,

    those are stylesheets so instead of:

    wp_dequeue_script and wp_deregister_script

    You should use:

    wp_dequeue_style and wp_deregister_style

    Thread Starter theotheo

    (@theotheo)

    It doesn’t work either way that’s why i tried dequeue script too.

    This code:

    add_action( 'wp_enqueue_scripts', 'remove_parent_style', 999999 );
    function remove_parent_style() {
        wp_dequeue_style( 'generate-style' );
        wp_deregister_style( 'generate-style' );
    }

    Tested using a Child theme on a clean install of GP.
    It breaks all the theme styles as expected, but it works.

    Thread Starter theotheo

    (@theotheo)

    ok…i don’t know what happens in my case.

    Btw when you have a functions.php in the child theme is it overriding the parent functions.php or is parent still loaded?

    Unless you have some other function running that affects the loading of scripts, that should work. Also make sure you have no page caching enabled as you may be seeing a cached request.

    Parent theme functions.php is always loaded.
    The code within maybe conditional though. For example line 17 of the the theme functions.php:

    if ( ! function_exists( 'generate_setup' ) ) {

    This line checks if the generate_setup function already exists eg. in your child theme, if it does then the code within won’t run.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Dequeue parent theme certain css file’ is closed to new replies.