Extra theme cause style error for Branda and Defender

When I activate Extra theme on my website, Branda and Defender panels lost its styling. How can I solve that?

  • Pawel Pela
    • Ex Staff

    Hello Bertrand!

    I hope you’re well today and thank you for reaching out to us!

    The issue comes from the fact that when you activate your theme, it changes the order of CSS styles that are queued by WordPress. So when your theme loads, it overrides all the styles that were set in Defender’s and Branda’s CSS files.

    I made a snippet that may solve this, but I didn’t test it with your theme – I have no access to it. Please test the snippet ba adding it to the end of your child theme’s functions.php:

    add_action('admin_enqueue_scripts', function() {
    global $wp_styles;

    if (($key = array_search('branda-admin', $wp_styles->queue)) !== false) {
    unset($wp_styles->queue[$key]);
    }

    if (($key = array_search('defender-css', $wp_styles->queue)) !== false) {
    unset($wp_styles->queue[$key]);
    }

    if (($key = array_search('sui-styles', $wp_styles->queue)) !== false) {
    unset($wp_styles->queue[$key]);
    }

    $wp_styles->queue[] = 'sui-styles';
    $wp_styles->queue[] = 'branda-admin';
    $wp_styles->queue[] = 'defender-css';
    }, 0);

    What id does is it tries to move the appropriate CSS files for Branda and Defender to the end of the queue, so they are applied after everything else.

    It may work on first go, although as I said – I wasn’t able to test it with the Extra theme.

    If it doesn’t work, please upload a zip file of the theme to Dropbox or similar and send me a download link via our contact form:

    https://wpmudev.com/contact/#i-have-a-different-question and the template below:

    NOTE: Don’t change selected topic in the dropdown, just leave it at “I have a different question”.

    Subject: “Attn: Pawel Pela

    – Download link

    – Link back to this thread for reference

    – Any other relevant urls/info

    Kind regards,

    Pawel