[ad_1]
Hello I am simply trying to create a wordpress theme from scratch . I created a functions.php and I want to link my css file to index.php.
​
<?php
function theme_files()
{
wp_enqueue_style( ‘mytheme-style’, get_theme_file_uri(‘/build/buildstyle.css’) );
}
add_action(‘wp_enqueue_scripts’, ‘theme_files’);
?>
This function runs when i test it with a echo. But the css file doesn’t apply to the index.php. What am I missing to get my css file to run on index.php without having to link it in the head?
[ad_2]
On a separate line before you do the enqueue, copy your get_theme_file_uri() function call and echo it to ensure that it’s doing what it should be doing. Test that it returns a valid url.
The path is incorrect if this is the main css – try:
`wp_enqueue_style(‘mycss’, get_stylesheet_uri() );`
If not, try it without the /
`wp_enqueue_style( ‘mytheme-style’, get_theme_file_uri( ‘build/buildstyle.css’ ) );`