• I am converting a bootstrap site into a wp theme (first one) using xampp.
    The site looks like it should bar a few errors. The first error I get is this. I don’t understand what it means.
    Also if I using wp_enqueue in my function.php do I have to use the @import in my stylesheet? I am using both.

    <link href="
    <b>Warning</b>:  Missing argument 1 for wp_enqueue_style(), called in C:\xampp\htdocs\wordpress\wp-content\themes\salon\header.php on line 14 and defined in <b>C:\xampp\htdocs\wordpress\wp-includes\functions.wp-styles.php</b> on line <b>158</b>
    /css/style.css" rel="stylesheet" type="text/css"></strong>
    
    <strong>This is line 14 in header.php</strong>
    <link href="<?php wp_enqueue_style(); ?>/css/style.css" rel="stylesheet" type="text/css">
    
    <strong>This is what I have on line 158 in functions.wp-styles.php</strong>
    function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
    	global $wp_styles;
    	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
    		if ( ! did_action( 'init' ) )
    			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
    				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
    		$wp_styles = new WP_Styles();
    	}
    
    	if ( $src ) {
    		$_handle = explode('?', $handle);
    		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
    	}
    	$wp_styles->enqueue( $handle );
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    It means that you are using the wp_enqueue_style improperly.

    The way it works is by using a handle name and then you use the location.

    So if you wanted to use a simple CSS file:

    add_action( 'wp_enqueue_scripts', 'my_css' );
    function my_css(){
      wp_enqueue_style( 'style-name', 'url-to-file' );
    }

    If you have something that requires|uses|depends on another then you can do something like:

    add_action( 'wp_enqueue_scripts', 'depend_css' );
    function depend_css(){
      wp_enqueue_style( 'style-name', 'url-to-file' );
      wp_enqueue_style( 'dependant-css', 'url-to-file', array( 'style-name' ) );
    }
    Thread Starter ms_missy

    (@ms_missy)

    This is what my function.php looks like.

    <?php
    
    function salon_styles_scripts() {
    	wp_register_script('jquery-ui', get_stylesheet_directory_uri().'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js', array('jquery') );
    	wp_enqueue_script('jquery-ui');
    	wp_enqueue_script( 'jquery-isotope', get_template_directory_uri(). '/js/jquery.isotope.min.js', array( 'jquery' ) );
    	wp_enqueue_script( 'sorting', get_template_directory_uri(). '/js/sorting.js', array( 'jquery' ) );
    	wp_enqueue_script( 'bootstrap', get_template_directory_uri(). '/js/bootstrap.min.js', array( 'jquery' ) );
    	wp_enqueue_script( 'jquery-prettyPhoto', get_template_directory_uri(). '/js/jquery.prettyPhoto.js', array( 'jquery' ) );
    	wp_enqueue_script( 'jquery-twitter', get_template_directory_uri(). '/js/jquery.twitter.js', array( 'jquery' ) );
    	wp_enqueue_script( 'superfish', get_template_directory_uri(). '/js/superfish.js', array( 'jquery' ) );
    	wp_enqueue_script( 'jquery-flexslider', get_template_directory_uri(). '/js/jquery.flexslider-min.js', array( 'jquery' ) );
    	wp_enqueue_script( 'jquery-animate', get_template_directory_uri(). '/js/animate.js', array( 'jquery' ) );
    	wp_enqueue_script( 'myscript', get_template_directory_uri(). '/js/myscript.js', array( 'jquery' ) );
    	wp_register_style( 'css-salon', get_template_directory_uri().'/css/style.css');
    	wp_enqueue_style( 'css-salon'); //default
    	wp_enqueue_style( 'css-animate', get_template_directory_uri() . '/css/animate.css' ); //our stylesheet
    	wp_enqueue_style( 'css-bootstrap-min', get_template_directory_uri() . '/css/bootstrap.min.css' ); //our stylesheet
    	wp_enqueue_style( 'css-bootstrap-theme', get_template_directory_uri() . '/css/bootstrap-theme.min.css' ); //our stylesheet
    	wp_enqueue_style( 'css-flexslider', get_template_directory_uri() . '/css/flexslider.css' ); //our stylesheet
    	wp_enqueue_style( 'css-pretty-photo', get_template_directory_uri() . '/css/prettyPhoto.css' ); //our stylesheet
    
    }
    add_action('wp_enqueue_scripts','salon_styles_scripts');
    ?>
    Thread Starter ms_missy

    (@ms_missy)

    Thanks for your answer by the way Jose ??

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    1. Please try to use the backticks when you are posting code; if it is more than ten lines think about using pastebin.com or gist.github.com for that.

    2. I want to say the issue does arise more from the header file now that I look at the code a little closer. The million dollar question is: are you using a child theme? ( If this is a custom-built theme, please disregard previous question ).

    3. The cool thing about the wp_enqueue_(style|script) functions is that you don’t need to have anything on the header other than: wp_head(). The reason is because behind the scenes it will build the markup for it. So, if you are using a stylesheet it will automatically use <link rel="stylesheet" href="..."> or <script></script> for script files. ??

    4. If you are ever lost on how the core functions work, you can always look in the developer reference site and look up how they work. ??

    Thread Starter ms_missy

    (@ms_missy)

    This is bootstrap theme converted into a wp theme. No child theme. I seemed to have resolved the issue somehow by editing the link in header to make it look like this.
    <link href=”<?php wp_enqueue_style(‘salon_styles_scripts‘); ?>” rel=”stylesheet” type=”text/css”>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘What does this error mean?’ is closed to new replies.