排队的css文件不起作用



我设法将css文件放入子主题中,但css文件不起作用!!为什么?代码是正确的,此代码在子主题的样式文件中工作

function enqueue_pure_styles() {
$suffix = '';
if (is_single()) {
$suffix = '.xdovom';
} 
wp_enqueue_style('pure-styles', get_stylesheet_directory_uri().'/styles'.$suffix.'.pure.css');

}

// enqueue our purified css file
add_action('wp_print_styles', 'enqueue_pure_styles', PHP_INT_MAX);

/*
Theme Name:   Newspaper Child
Theme URI:    https://www.farid.com/newspaper-child/
Description:  Newspaper Child Theme
Author:       Fraid Hosein
Author URI:   https://hosein.com
Template:     Newspaper
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain:  newspaperchild
*/
.td-post-content {
background-color: lightblue;
}

使用wp_enqueue_scripts而不是wp_print_styles

https://developer.wordpress.org/reference/hooks/wp_print_styles/

最新更新