css - Twenty Twenty Four child theme stylesheet is not being enqueued in admin panel when editing pages

admin2025-01-07  4

I have created a child theme of Twenty Twenty four. I have a styles.css in the child theme directory and I have enqueued the stylesheet to load in the child theme's functions.php:

<?php
/* 
* Dirigo 2024 theme functions
*/

add_action( 'wp_enqueue_scripts', 'dirigo_2024_enqueue_styles' );

function dirigo_2024_enqueue_styles() {
    wp_enqueue_style( 
        'dirigo-2024', 
        get_stylesheet_uri()
    );
}

In my styles.css, I have a declaration to override the color of the theme's selected style button:

:root :where(.wp-block-button.is-style-outline--2 .wp-block-button__link) {
    background-color: orange !important;
}

This renders correctly when viewing a page where the button has been included. However, when editing the page, the CSS declaration override is not being applied due to the styles.css not being loaded.

I don't remember this being an issue pre block themes. Is there a preferred approach to child themes and this particular issue?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736261409a739.html

最新回复(0)