Title: Cannot link CSS file
Last modified: December 8, 2017

---

# Cannot link CSS file

 *  [adamr100](https://wordpress.org/support/users/adamr100/)
 * (@adamr100)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/cannot-link-css-file/)
 * Hello, I have been trying for days now to link my CSS page into my wordpress 
   page.
 * They are hosted locally on my computer via MAMP. I am trying to build a custom
   theme at the minute and
 * This is the error code I get via the chrome developer console:
    Failed to load
   resource: the server responded with a status of 500 (Internal Server Error)
 * I have tried several different methods to get the CSS to link but it won’t work.
   I don’t know if it has anything to do with the PHP Configuration but MAMP suggests
   the PHP config is fine.
 * Here are my files. (Excuse the file names, I was following a youtube tutorial.)
 * **style.css files **
    /* Theme Name: Awesome Theme Author: Adam Version: 0.0.6
   Description: This is an awesome theme Tags: Testing, Sample, Please work Licence:
   GNU General Public License v2 or later /*
 * Background {
    color: blue; }
 * **functions.php file**
    <?php
 * function awesome_script_enqueue() {
 *  wp_enqueue_style(‘customstyle’ , get_template_directory_uri() , ‘/css/awesome.
   css’ , array(), ‘0.0.6’ , ‘all’);
    wp_enqueue_script(‘customjs’, get_template_directory_uri(),‘/
   js/awesome.js’ ,array(), ‘0.0.6’, true); }
 * add_action(‘wp_enqueue_scripts’, ‘awesome_script_enqueue’)
    ?>
 * **awesome.css file **
    html, body { margin: 0; color: blue; background: grey;
   font: sans-serif;
 * }
 * body {
    padding: 20px; }
 * **index.php**
 * <?php get_header(); ?>
    <h1> This is my index </h1> <?php get_footer(); ?>
 * **footer.php **
 *  <footer>
    <p> This is my footer </p> </footer> </body> </html>
 * <b> header.php</B
    <!doctype html> <html> <head> <meta charset=”utf-8″> <title
   > Awesome Theme </title> <?php wp_head(); ?> </head> <header> This is my header
   </header>
 *  <body>

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [adamr100](https://wordpress.org/support/users/adamr100/)
 * (@adamr100)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9763766)
 * It’s driving me insane and I cannot work out why. I am open to advice/feedback
   if there is a better option to use for a website wide css file.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9764049)
 * First off ditch MAMP, you are on a MAC, USE IT
    [https://mallinson.ca/osx-web-development/](https://mallinson.ca/osx-web-development/)
 * Second, your code is a bit incorrect
 *     ```
       function awesome_script_enqueue() {
   
       wp_enqueue_style(‘customstyle’ , get_template_directory_uri() , ‘/css/awesome.css’ , array(), ‘0.0.6’ , ‘all’);
       wp_enqueue_script(‘customjs’, get_template_directory_uri() , ‘/js/awesome.js’ ,array(), ‘0.0.6’, true);
       }
   
       add_action(‘wp_enqueue_scripts’, ‘awesome_script_enqueue’)
       ```
   
 * You used commas and in php a . (period) concatenates strings.
    AND you set an
   empty array… Does your script depend on jQuery or is it Vanilla JS? If it needs
   jQuery it should be array(‘jquery’) [https://developer.wordpress.org/reference/functions/wp_enqueue_script/](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)
   There is no array in the css call though. True and False are for version and 
   place in footer
 * try this:
 *     ```
       wp_enqueue_style(‘customstyle’ , get_template_directory_uri() . ‘/css/awesome.css’ , false, '0.0.6');
       ```
   
 *     ```
       wp_enqueue_script(‘customjs’, get_template_directory_uri() . ‘/js/awesome.js’ ,array('jquery), ‘0.0.6’, true);
       ```
   
 *  Thread Starter [adamr100](https://wordpress.org/support/users/adamr100/)
 * (@adamr100)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9764493)
 * Hello, thanks for your detailed reply.
 * I have currently made several steps backwards I think…
 * I followed the instructions on your link to install SQL etc and when I access‘
   localhosts’ all I get is ‘it works’.
 * I have followed several threads to point this page to my sites location for it
   to load my page but no matter what it just says ‘it works’
 * Thank you.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9765029)
 * There are a few other steps you need to do detailed in that tutorial to get everything
   set up perfectly. Follow it all the way to the suggestions section and install
   everything required. Makes web dev SO much easier. I deleted MAMP Pro years ago.
 * On my Mac, I jet create a new WordPress install in my WWW folder and type folderName.
   dev into the address bar and it loads up the site.
 * Did you get the script and CSS to enqueue correctly? You can still use MAMP until
   you have everything set up in OSX –
 *  Thread Starter [adamr100](https://wordpress.org/support/users/adamr100/)
 * (@adamr100)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9765091)
 * I think I have made some progress but now whenever I type in localhost I get 
   a page full of PHP information. WHich isn’s in my ‘site’ directory.
 * I don’t know if I have a messy repository of installs etc now and that might 
   be the reason. Is there a way to remove apache, php, homebrew etc in totality
   and start agaib?
 * THe script and the CSS didnt enqueue correctly no.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9771233)
 * If you followed the tutorial correctly and installed everything you should just
   have to type in folderName.dev like wordpress.dev.
 *  [RossMitchell](https://wordpress.org/support/users/rossmitchell/)
 * (@rossmitchell)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9783179)
 * My quick reading of the code snippets showed some incorrect single quote character
   usage, this can be very tricky as different editors apply different interpretations
   and your PHP engine only wants to see the single quote character which on my 
   keyboard is beside the semicolon key.
 * Also suggest that you get going with a standard theme which will give you confidence
   that you can compare your files to the ones which work. You may have already 
   done this.
    -  This reply was modified 8 years, 5 months ago by [RossMitchell](https://wordpress.org/support/users/rossmitchell/).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Cannot link CSS file’ is closed to new replies.

## Tags

 * [css help](https://wordpress.org/support/topic-tag/css-help/)

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 7 replies
 * 3 participants
 * Last reply from: [RossMitchell](https://wordpress.org/support/users/rossmitchell/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/cannot-link-css-file/#post-9783179)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
