Child Theme and Stylesheet CSS not working

Posted in: Newspaper
Post count: 4

I followed the guide from WordPress and TagDiv, but my child theme’s stylesheet is not loading. Here are the codes I have in functions.php:

<?php
function my_theme_enqueue_styles() {

$parent_style = 'td-theme';

wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>

I read the latest post about this issue and followed some examples, but it’s still not working.

I created a functions.php, style.css in a new directory called Newspaper-child. The style.css is blank. The functions.php has the code above. Why is it that no stylesheet loads? Doesn’t it fetch AND load the files and stylesheets from the parent template before checking the child? So even if my style.css is blank, it should work, right?

Let me know what I’m not doing right. Thank you.

Post count: 4

<link rel='stylesheet' id='td-theme-css' href='https://mywebsite.com/wp-content/themes/Newspaper?ver=4.9.8' type='text/css' media='all' />

^ That’s how my website loads the stylesheet. I’m not entirely sure if that might be the issue.

Post count: 1043

The theme comes with its own child theme. Download “All files and documentation” from ThemeForest and extract it. Look inside the ‘code’ folder of the extracted file for the child theme.

Post count: 4

Thanks! It worked 🙂

Post count: 1043

You are welcome.

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.