Wordpress - essentials
I know we get taught that to be able to link our stylesheets and scripts we need to link them in our headers which is completely awesome in most cases. When using wordpress though it has it’s own functionality and needs to be linked through its php function class.
I maintain a site made by someone who I don’t know and they should’ve been more experienced than me. As I started to learn WordPress and learn the different aspects to it I found out that one has to enque the scripts through the function.php file.
Why is this so amazing ?
Because this php file allows for one to be selective in which pages or posts get what javascript file or css file. If you have a big site some of these files often times end up clashing with one another. If you need to keep JQuery as a older version in one page because it has older functionality but need the newer improvements in another you can just specify in your function which goes where.
It’s also more clean the code just looks better. No offense to non-wordpress sites that have to link their stylesheets and scripts in their header.
Well this post is just to remind people that if they’re using wordpress to use the proper functionality because now I have to switch all the links from being in the header to the function.php file.










