This function dosen't work any thoughts

function css()  
{  

    // Register the style like this for a theme:  
    wp_register_style( 'custom-style', get_template_directory_uri() . '/css/style.css', array(), '20120208',      'all' );  

    // For either a plugin or a theme, you can then enqueue the style:  
    wp_enqueue_style( 'custom-style' );  
}  
add_action( 'wp_enqueue_scripts', 'css' ); 

?>

And it says that template is missing and if i use the clasic wp 2.6 compatible code

<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />

It works fine but wp codex says this is the wrong way can anyone explain this
How can I use the new feuaters of wp 3 and above form codex
Codex with best practices
Thank you in advance.

Try this:

function custom_css(){
    if( !is_admin() ){
        $css_path = get_bloginfo('template_directory').'/';

        wp_register_style('custom-css',$css_path.'css/custom.css',array().'1.0','all');
        wp_enqueue_style('custom-css');
    }
}

add_action('wp_enqueue_scripts','custom_css');

Tried it not working I will look in to it but for now I am working on something else thank you

Rightly or wrongly, I usually use the init action.

/**
 * Load stylesheet and scripts.
 *
 * @return void
 */
function load_styles_scripts()
{
    // Register stylesheets
    wp_register_style('custom', get_bloginfo('stylesheet_directory') . '/stylesheets/custom.css');
    wp_enqueue_style('custom');

    // Register scripts
    wp_register_script('custom', get_bloginfo('stylesheet_directory') . '/javascripts/custom.js');
    wp_enqueue_script('custom');
}
add_action('init', 'load_styles_scripts');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.