Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress WordPress Theme Development Working with CSS and JS in WordPress Themes How to Link to JS from functions.php File

Naty Sipka
Naty Sipka
5,212 Points

Hi guys, I am getting error message: Internal Server Error or Not Found

I am working with MAMP and everything was working just fine until I came to this step in course. I am getting error messages:

Not Found The requested URL /test.dev/wordpress/ was not found on this server.

or

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, xxx@xxx.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

I am trying to change document root for another project I made, but with no success. Can you please suggest me how to fix it? Thanks!

My functions.php if it can help:

```<? php

function wpt_theme_styles() {

wp_enqueue_style( 'foundation_css', get_template_directory_uri() . '/css/foundations.css' );

wp_enqueue_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );

wp_enqueue_style( 'normalize_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic');

wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );

} add_action ( 'wp_enqueue_scripts', 'wpt_theme_styles' );

function wpt_theme_js() {

wp_enqueue_script( 'modernizr_js', get_template_directory_uri() . '/js/modernizr_js', '', '', false );
wp_enqueue_script( 'foundation_js' , get_template_directory_uri() . '/js/foundation_js', array('jquery'), '' , true );
wp_enqueue_script( 'main_js' , get_template_directory_uri() . '/js/app.js', array('jquery', 'foundation_js'), '' , true );

} add_action( 'wp_enqueue_scripts', 'wpt_theme_js' );

?>

Aurelian Spodarec
Aurelian Spodarec
10,789 Points

Would you post some screenshots of what you're doing? I might know what that is, I think I had the same few days ago.

4 Answers

Konrad Traczyk
Konrad Traczyk
22,287 Points

Hi,

Try remove closing php tag "?>", it can cause many troubles like white screen, and it's often made mistake even by experienced devs. Also turn on debug mode in wp-config.php(line 80) to get more specific errors.

Hope it helps

Paul Walker
Paul Walker
28,904 Points

I notice you have two "normalize.css", one should be 'googlefont_css'. where your linking to the googleapis. I commented out the normalize.css in mine but not sure why I did that. Good luck.

Beth Palmer
Beth Palmer
1,113 Points

Try with <?php rather than <? php

Konrad Traczyk
Konrad Traczyk
22,287 Points

I think that's "<? php" was formatted by treehouse to prevent script executing, writing php tag like that, in worst case causes "only" a parse error. Not 500

Paul Walker
Paul Walker
28,904 Points

Hey Naty, You have two normalize.css the other should be googlefont_css. Hope this helps.

Richard Burr
Richard Burr
546 Points

In the js function, the name of the files should be "xxx.js" instead of "xxx_js"... Also, the video forgets to make the addition to the file name: it should be 'foundation.min.js" instead of "foundation.js"