Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCarla Thomas
Front End Web Development Techdegree Student 16,039 PointsIncorrect file; how to correct
When viewing page source, I am getting the following link:
href='http://localhost/carlathomas.com/wp-content/themes/wpportfolio/css/main.css?ver=3.9.1'
The problem is that main.css should be style.css.
How can I correct this? Thanks in advance.
Carla
5 Answers
Dustin Matlock
33,856 PointsIf you could post your code I can compare it for you. Otherwise, you should have something similar to this.
<?php
// Load the Theme CSS
function theme_styles() {
wp_enqueue_style( 'normalize', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style( 'grid', get_template_directory_uri() . '/css/grid.css' );
wp_enqueue_style( 'googlefonts', 'http://fonts.googleapis.com/css?family=Sorts+Mill+Goudy:400,400italic' );
wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'social', get_template_directory_uri() . '/css/webfonts/ss-social.css' );
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );
if( is_page( 'home' ) ) {
wp_enqueue_style( 'flexslider' );
}
}
// Load the Theme JS
function theme_js() {
wp_register_script( 'flexslider', get_template_directory_uri() . '/js/flexslider.js', array('jquery'), '', true );
if( is_page( 'home' ) ) {
wp_enqueue_script( 'flexslider' );
}
wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );
}
add_action( 'wp_enqueue_scripts', 'theme_js' );
add_action( 'wp_enqueue_scripts', 'theme_styles' );
// Enable custom menus
add_theme_support( 'menus' );
?>
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsThank you! Yes, the problem was that I copy/pasted the same line....but I failed to correctly link to the css file.......THANK YOU! :)
Dustin Matlock
33,856 PointsI must have been reading too fast to realize you weren't having an issue with CSS caching while in development. Glad you got it!
Dustin Matlock
33,856 PointsCarla, you'll want to just right click
and view page source
, not use an inspector which will sometimes give you versioning.
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsHi Dustin. Thanks for the feedback. Yes, I am (1) right clicking on the site page and then (2) clicking on the link.....however, the link itself is incorrect. It should be linked to a "style.css" and not a "main.css".
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsHi Dustin. Thanks for the feedback. Yes, I am right (1) clicking on the site page and then (2) clicking on the link.....but the link itself is incorrect. It should reference a style.css, not a main.css.
Dustin Matlock
33,856 PointsAny way you could post a screenshot of what you're seeing?
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points...my first time trying to post an image to a forum (let's see if this works).
<img src="http://i58.tinypic.com/23tl111.png">
Dustin Matlock
33,856 PointsSee if this solution works for you.
Dustin Matlock
33,856 PointsYou could also try a plugin.
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsThank you so much for your help, but I am linking to CSS using the function.php file and wp_register_style() and wp_enqueue_style()....I am currently on the WP Development track (the "Linking CSS" video)....I keep replaying the video but I cannot seem to figure out why it says "main.css" instead of "style.css".
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsCarla Thomas
Front End Web Development Techdegree Student 16,039 Points...when I click on the link to view my styles, I am instead forwarded to the home page of my site. Very frustrating.