How to add css in to php wordpress files?

Check out this link which will help you to add CSS files in HTML page.

Go to w3schools.com and search a topic CSS How to. That will help you do it.


Thank you,
Michael Saba
 
If you have applied your html tags correctly, you would simply have to link your css file at the top of the html code so that it would apply the styling.
 
Code:
<style>
// Your CSS Here
</style>
 
you don't add CSS to the PHP, CSS is done in your CSS file. In your child theme put any changes in there, always use a child theme with WordPress, never edit or adapt core code. You will lose any changes you make when there is an update
 
You can do any CSS coding with the help of Jetpack plugin which is free on WordPress
use this plugin to edit or add any CSS code on WordPress.

But you need an account on wordpress.org (which is free).
 
You can do any CSS coding with the help of Jetpack plugin which is free on WordPress
use this plugin to edit or add any CSS code on WordPress.

But you need an account on wordpress.org (which is free).
Trouble with Jetpack is it wants to take over, it's annoying when the work can be done in a child theme so one less plugin
 
Trouble with Jetpack is it wants to take over, it's annoying when the work can be done in a child theme so one less plugin

You may be right, but I find this easy as compare to child theme

Child theme method requires some experience and it's not a method for a newbie I guess.
 
You may be right, but I find this easy as compare to child theme

Child theme method requires some experience and it's not a method for a newbie I guess.
Yes you are quite right there, Child themes can be a bit daunting. I am so use to using them i forget at times that beginners need easier solutions.
 
Child themes can be a bit daunting. I am so use to using them i forget at times that beginners need easier solutions.

You are right my friend, and there are some update issues as well when using a child theme method.
 
You are right my friend, and there are some update issues as well when using a child theme method.
No update issues with a child theme, that's the point of it. If you use a child theme you don't have to update it when the theme is updated as Wordpress checks the child theme first and then moves onto the core files. anything inside of a child theme is never overwritten, that's why professionals like myself use them. Imagine if you have lots of clients, you'd be forever going back to the same sites updating, that why we use child themes
 
No update issues with a child theme, that's the point of it. If you use a child theme you don't have to update it when the theme is updated as Wordpress checks the child theme first and then moves onto the core files. anything inside of a child theme is never overwritten, that's why professionals like myself use them. Imagine if you have lots of clients, you'd be forever going back to the same sites updating, that why we use child themes


Well I read somewhere about update issue, but I guess that's not the case
and thank you for correcting me as I hardly use child themes for editing purpose.
 
Well I read somewhere about update issue, but I guess that's not the case
and thank you for correcting me as I hardly use child themes for editing purpose.
That's ok, WordPress.org advises to always use child themes, as it's a child of the main theme ( hence the name ) it's not the child theme that gets updated, it's always the core code of wordpress itself, udates never affect the child theme, that's why we use them. It saves time and hassle as you make changes once and never have to touch it again, no matter how many times a theme is updated
 
you don't add CSS to the PHP, CSS is done in your CSS file. In your child theme put any changes in there, always use a child theme with WordPress, never edit or adapt core code. You will lose any changes you make when there is an update
I've done it with this tutorial (external style sheet). I've extracted HTML and CSS with SnappySnippet, img here (and element I shuld see) and just added them to my files. When I open my index file with crome I see only HTML.
What am I doing wrong?
 
In your functions file you suppose to enqueue style here is how to do it.

Function add_theme_style()
{
wp_enqueue_style('style',get_template_directory_uri.'/css/style.css);
}

add_action('wp_enqueue_scripts','add_theme_style');

One more thing dont copy above code as i just wrote this to explain how enqueue works

so go in google and look for enqueue in wordpress.

hopr it will help you.
 
In your functions file you suppose to enqueue style here is how to do it.

Function add_theme_style()
{
wp_enqueue_style('style',get_template_directory_uri.'/css/style.css);
}

add_action('wp_enqueue_scripts','add_theme_style');

One more thing dont copy above code as i just wrote this to explain how enqueue works

so go in google and look for enqueue in wordpress.

hopr it will help you.
Alright this is what I have now. Endings of index.php and style.css
As you can see I've added css to style.css (9MB), added link rel in index.php
And still I can only see basic HTML
Only suspicious thing I've found was js in index.php
What did I do wrong?
Trying to solve this problem a whole month or months...:(
 
Back
Top