0

I'm trying to inject a style.css script into my front-page.php. I am able to load front-page's content by not link the style.css.

When you inspect page source, all the CSS should be there, but it simply shows the wp_head() script without injecting anything.

My functions.php, front-page.php, and style.css are all in the same root directory.

front-page.php

     <head>
        <php? 
            wp_head(); 
        ?>
    </head>

** Edited the functions.php file**

    <?php

        function load_scripts(){
            wp_enqueue_style('style', './style.css' );
        }

        add_action( 'wp_enqueue_scripts', 'load_scripts');  
    ?>

Added <php? wp_head(); ?> to the front-page.php in the head tag.

    <head>
        <php? wp_head(); ?>
    </head> 

style.css sheet

/* 
Theme Name: InfluencerSite
Text Domain: InfluencerSite
Version: 1.0
Description: Fancy stuff 
Tags: left-sidebar, responsive, fancy
Author: Shawn Esquivel
Author URI: github.com/shawnesquivel
*/


.testing {
  color: red;
}

Other Things I tried adding into the functions.php script

    wp_enqueue_style('anydescription', get_stylesheet_uri(), array(), "1.0", 'all'); 


    wp_enqueue_style('any-style-name', get_stylesheet_uri());

    wp_enqueue_style("style", get_template_directory_uri() . "./style.css");
2
  • 2
    There must not be a questionmark after <?php. You have written <?php? but it must be <?php Commented Dec 18, 2022 at 19:24
  • @stefket on the money! syntax error, thank you.. Is there some sort of extension yo use to catch errors like this in the code editor? Commented Dec 20, 2022 at 0:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.