Trying to load Custom CSS file
-
We’re switching to a custom font and I’m having difficulty enqueueing the stylesheet into our theme’s child directory. Here is the file structure.
home > public_html > wp-content > themes > phlox-child > fonts > MyFontsWebfontsKit.css
Here’s my functions.php code in the child theme. I’ll specify the errors I get for each of these in the same order (below this function)
function theme_styles() { //. wp_enqueue_style( 'custom', get_template_directory_uri() . '/fonts/MyFontsWebfontsKit.css' ); // wp_enqueue_style( 'custom', get_stylesheet_directory_uri() . '/fonts/MyFontsWebfontsKit.css' ); wp_enqueue_style( 'custom', 'https://equipourkids.org/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css' ); } add_action('wp_enqueue_scripts', 'theme_styles');
1st line of code gives me this
console
GET https://equipourkids.org/wp-content/themes/phlox/fonts/MyFontsWebfontsKit.css?ver=5.5 net::ERR_ABORTED 404(index):120 GET https://equipourkids.org/public_html/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css net::ERR_ABORTED 404
sources
404
<link rel=”stylesheet” type=”text/css” href=”/public_html/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css”>2nd line of code gives me this
console
GET https://equipourkids.org/public_html/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css net::ERR_ABORTED 404sources
404
<link rel=”stylesheet” type=”text/css” href=”/public_html/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css”>3rd line of code gives me this
console
GET https://equipourkids.org/public_html/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css net::ERR_ABORTED 404sources
<link rel=”stylesheet” type=”text/css” href=”/public_html/wp-content/themes/phlox-child/fonts/MyFontsWebfontsKit.css”>
- The topic ‘Trying to load Custom CSS file’ is closed to new replies.