TransWikia.com

wp_enqueue_style not working if the file is in a sub folder

WordPress Development Asked by battx726 on October 30, 2021

I use wp astra to customize our site and have set up a child theme but for some reason, the wp_enqueue_style is not working if the file is in a subfolder.

When I view source the page, it does output the URL like this <link rel='stylesheet' id='my-css-css' href='https://my-domain-url/wp-content/themes/astra-child/assets/css/style.css?ver=1.1' media='all' /> but when I click and visit the URL I get 404 page not found.

Here’s the wp enqueue code.

wp_enqueue_style( 'my-css-css', get_stylesheet_directory_uri() . '/assets/css/style.css', array('astra-theme-css'), '1.1', 'all' );

This one works if I put the file inside the main folder of the child theme.

wp_enqueue_style( 'my-css-css', get_stylesheet_directory_uri() . '/style.css', array('astra-theme-css'), '1.1', 'all' );

Can anyone help and explain why it doesn’t work?

Thank you in advance! Cheers!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP