| Muhammad Yaseen
HOW TO REFERENCE CSS FILE IN WORDPRESS ON CUSTOM PAGES
We can add or reference our CSS file into Word Press custom pages in many ways, we will discuss two of them in this blog.
But keeping in mind we cannot simply use this <link rel="stylesheet" href="mystyle.css">.
Rather than loading the style sheet in your header file, you should load it in using wp_enqueue_style. In order to
load your main style sheet, you can en-queue it in functions.php file.
To en-queue style.css
This will look for a stylesheet named “style” and load it.
The basic function for en-queuing a style is:
You can include these parameters:
- $handle is simply the name of the style sheet.
- $src is where it is located. The rest of the parameters are optional.
- $deps refers to whether or not this style sheet is dependent on another style sheet. If this is set, this style sheet will not be loaded unless its dependent style sheet is loaded first.
- $ver sets the version number.
- $media can specify which type of media to load this style sheet in, such as ‘all’, ‘screen’, ‘print’ or ‘handheld.’
So if you wanted to load a stylesheet named “slider.css” in a folder named “CSS” in you theme’s root directory, you would use:
Second method, To add CSS file, just link the file in the header. Using
get_stylesheet_directory_uri () function
Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.