0

I am beginner in wordpress. I am trying to give path of my css file in header.php and am I trying this, but I can not link my css file in my header.php

Is there any problem in my code. I can not find my css file in page source.

<link rel="stylesheet" id="jquery-ui-theme-css" href="<?php echo get_template_directory_uri(); ?>/css/jquery-ui_002.css" type="text/css" media="all">

1 Answer 1

2

Instead of that, try this in your functions.php

// Proper way to enqueue styles (from https://codex.wordpress.org/Function_Reference/wp_enqueue_script)
function wpse182193_load_style() {
    wp_register_style( 'my-stylesheet', get_stylesheet_directory_uri() . '/css/jquery-ui_002.css', array(), '');
    wp_enqueue_style( 'my-stylesheet' );
}
add_action( 'wp_enqueue_scripts', 'wpse182193_load_style' );
9
  • after that i have to include function file in my header.php or not.. Mar 25, 2015 at 5:02
  • If your theme has a functions.php you don't have to include anything more.
    – jimihenrik
    Mar 25, 2015 at 5:03
  • no it is not have that file so what me do now. me create that file in to my theme folder name is "function.php" and me put this function in this file.. Mar 25, 2015 at 5:04
  • I have no idea how a theme functions without functions.php so I really can't help any further, sorry.
    – jimihenrik
    Mar 25, 2015 at 5:07
  • 1
    @Mayeenul Islam fair point, I think I'll just leave it as is for now as the thread derailed anyway, but I'll be sure to do that in the future, thanks. Now to sleep ->
    – jimihenrik
    Mar 25, 2015 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.