in

How do I override plugin styles with the child theme style sheet?


This is my queuing script:

function my_load_child_theme_styles() {

    if ( ! defined( 'WPEX_THEME_STYLE_HANDLE' ) ) {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array(), '1.0' );
    }

    // First de-register the main stylesheet (which is now your child theme style.css)
    wp_dequeue_style( WPEX_THEME_STYLE_HANDLE );
    wp_deregister_style( WPEX_THEME_STYLE_HANDLE );

    // Add the parent style.css with the main style handle
    wp_enqueue_style( WPEX_THEME_STYLE_HANDLE, get_template_directory_uri() . '/style.css', array(), WPEX_THEME_VERSION );

    // Re-add child CSS with parent as dependency
    wp_enqueue_style( 'child-css', get_stylesheet_directory_uri() . '/style.css', array( WPEX_THEME_STYLE_HANDLE ), '1.0' );

    wp_enqueue_style(
    'child_media-css', // stylesheet handle
    get_stylesheet_directory_uri() . '/child_media_600_max.css', // stylesheet file URL
    array( WPEX_THEME_STYLE_HANDLE ), // dependencies
    '1.0', // stylesheet version
    'only screen and (max-width:600px)' // media query
);


wp_enqueue_style(
    'child_media-css', // stylesheet handle
    get_stylesheet_directory_uri() . '/child_media_600_min.css', // stylesheet file URL
    array( WPEX_THEME_STYLE_HANDLE ), // dependencies
    '1.0', // stylesheet version
    'only screen and (min-width:600px)' // media query
);


    

}
add_action( 'wp_enqueue_scripts', 'my_load_child_theme_styles', PHP_INT_MAX );

The problem is that the plugin style sheet doesn’t have any handle.

The child styles are already set as a dependency.

I already have a maximum priority for my child styles set.



Source: https://stackoverflow.com/questions/70626939/how-do-i-override-plugin-styles-with-the-child-theme-style-sheet

Javascript: How do I fetch all of the resources from an endpoint?

A react-leaflet & express app for visualizing the latest earthquake data from Kandilli Observatory