WordPress.org

Ready to get started?Download WordPress

Forums

Functions.php not working. At a loss of what to do. (5 posts)

  1. dustindowell
    Member
    Posted 2 months ago #

    This is my functions.php file and I can't get it to import my css:

    <?php
    
        function salt_scripts() {
    		//global $wp_styles;
    		//wp_enqueue_style( 'stylesheet', 'netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css');
    		//wp_enqueue_style( 'stylesheet', 'http://fonts.googleapis.com/css?family=Varela');
    
    		// Loads main stylesheet
            wp_enqueue_style( 'style', get_stylesheet_uri() );
            wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
            wp_enqueue_style( 'bootstrap-theme', get_template_directory_uri() . '/css/bootstrap-theme.min.css' );
            wp_enqueue_style( 'custom-styles', get_template_directory_uri() . '/css/custom-styles.css' );
    	}
    
    	add_action( 'wp_enqueue_scripts', 'salt_scripts' );
    
    ?>
    
    LKDJFLSDKJFLSDKFJSLDKFJ WORK

    I've also asked this question on stack-overflow, but I have yet to receive any answers. No idea what I'm missing.

  2. stephencottontail
    Member
    Posted 2 months ago #

    I'm guessing that "LKDJFLSDKJFLSDKFJSLDKFJ WORK" isn't part of your functions.php. Everything looks fine at first glance. Are there any error messages in your server logs? Is your main stylesheet named style.css? Note the singular.

  3. dustindowell
    Member
    Posted 2 months ago #

    That random string of text was just to check and see fit it was even being read by WordPress. That's the only thing that gets imported on any of my pages.

    Yes. my main stylesheet is named style.css. Here is the contents of that if it makes a difference:

    /*
    Theme Name: Salt Solutions
    Theme URI:
    Author: Dustin Dowell
    Author URI:
    Description: A static to WordPress conversion.
    Version: 1.0
    License:
    License URI:
    Tags: salt, solutions
    Text Domain: salt
    */
    
    html,
    body,
    div{
    	background-color: blue; /* test */
    }

    No, there is nothing about my WordPress installation in my server log.

  4. stephencottontail
    Member
    Posted 2 months ago #

    Can you post a link to your website?

  5. dustindowell
    Member
    Posted 2 months ago #

    This was the line I needed to fix my problem.

    <?php wp_head(); ?>

    I couldn't find anywhere in the documentation that said this was required to use functions.php.

Reply

You must log in to post.

About this Topic