I'm starting to build a WordPress theme from scratch. I have MAMP all loaded and running on my computer and WordPress is loaded fine. I have the below three files all in the same folder


The problem is I can't get the hook in the functions file to actually run the css code in the index file. As far as I can tell, it should. The functions and enqueue's all seem correct. So why wont these files communicate?


    <h1>Hello World</h1>
    <p class="once">This is an attempt at getting the functions file to work with the css files</p>
    <p class="twice">Why wont this work...</p> 


Theme Name: Test Theme
Description: This is a test to see if I can make a theme
Author: Ryan 
Author URI: ###
version: 1.0
Template: ABC

    color: red;

    text-align: canter;
    background-color: gray; 

    color: blue;


    function theme_resources() {
        wp_enqueue_style('style', get_stylesheet_uri());
  add_action('wp_enqueue_scripts', 'theme_resources');
  • let me know if you were able to resolve your problem @Ryan – prosti Oct 25 '16 at 7:37

Your theme has to call wp_head() in the head section of the html (probably best to place it at the end of it) and wp_footer() somewhere in your footer section. Those are mandatory function calls for all themes that want to be able to integrate with plugins and some core functionality like enqueuing JS and CSS depends on them.

If you do a "plain" HTML page, you have to manually insert the various CSS and JS into the HTML.


Although Marks answer deserves some respect, at the moment I am writing this he didn't mention probably the most important functions you need to have.

add_action( 'wp_head', ...
add_action( 'wp_footer', ...

I would take another approach in your case. Let's forget your theme for a second. I would start modifying some simple WordPress theme.

This may be the _s theme. "S" may stand for the Starter, or Start Up.

It looks so simple, but in fact, underneath you will have a Lamborghini engine. You will find in there all the good practices already implemented and wp_head and wp_footer actions you are missing.

Try to remove them and you will experience the same problem you had with your them.

Your further task may be to add some cool CSS to the theme and your theme may be fantastic after that.

More, you will be able to experiment with the Oenology theme. https://wordpress.org/themes/oenology/

This is a great theme that looks not so great (to be honest), but the code in there is a world class. Like a Rolls Royce or Bugatti.

I guess you are a beginner and I gave you +1 for your effort digging into the WordPress - platform of the future.

I congratulate you on your determination to work in WordPress and I wish you all the luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.