Moderator
t-p
(@t-p)
Does it work if you use the default theme?
Hey menre,
This sounds like you didn’t tell the page where to find your stylesheets.
In your header.php do you have this declared:
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
Also, in your style.css you’ll need to make sure you have:
@import url("stylesheets/yourstylesheet.css");
Hope that helps.
Ninja vanish!
Thread Starter
menre
(@menre)
Thanks all for your responses so far. As for your question Tara, yes the default theme works well.
Thank you for your suggestions ImageOmega. I used the link below and it helped a bit.
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
But the code below is a bit confusing to me.
@import url(“stylesheets/yourstylesheet.css”);
Another issue I am dealing with now is to make the JavaScript display. Do I need to reference the link in a specific way?
I will appreciate further help, please.
Thread Starter
menre
(@menre)
Thanks all for your responses so far. As for your question Tara, yes the default theme works well.
Thank you for your suggestions ImageOmega. I used the link below and it helped a bit.
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
But the code below is a bit confusing to me.
@import url(“stylesheets/yourstylesheet.css”);
Another issue I am dealing with now is to make the JavaScript display. Do I need to reference the link in a specific way?
I will appreciate further help, please.
Moderator
t-p
(@t-p)
yes the default theme works well.
It means there is a problem specific to the theme you are using.
Part of the reason you are having issues with your styles and scripts is that you may not be enqueuing them properly.
Best practice is to hook them to wp_enqueue_scripts
that way you not only have a cleaner header file ( if you have one ) but if you decide to decide to publically share your theme it will be a little easier to create a child theme for it. 🙂
So what you would do is create a callback function in your functions file:
//hook to wp_enqueue_scripts
add_action ( 'wp_enqueue_scripts', 'my_scripts_styles' );
function my_scripts_styles(){
wp_enqueue_script( 'my-js', get_template_directory_uri() . /js/my-js-file.js' );
wp_enqueue_style( 'my-theme-style', get_stylesheet_uri() );
}
Resources:
wp_enqueue_scripts
wp_enqueue_script
wp_enqueue_styles