Home > OS >  The css file that is enqueued does not work
The css file that is enqueued does not work

Time:09-09

I managed to enqueue a css file in the child theme but the css file didn't work!! Why? The code is correct, this code works in the style file of the child theme

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;
  }

CodePudding user response:

Use wp_enqueue_scripts instead of wp_print_styles

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

  • Related