For me, that meant getting the URL of the plugins directory using plugins_url, and then passing it the right arguments for it to produce the URL.
For us, if you copied the line above, it would be function_name.
Your first line of code is an add_action call which is used to make sure that WordPress runs the code that really contains your use of the enqueuing function.Wp_enqueue_style for Styling Your WordPress Site Everything from registering your own hooks to de-registering others:Ĭourse: A Complete Introduction to the WordPress Hooks System If you want even more depth about them, we’ve got a Course of free articles that goes deep. WordPress Hooks, Actions, and Filters: What They Do and How They Work We’ve got way more details about WordPress hooks generally in this great article: If you watched the video, you may have already caught it, but for wp_enqueue_style, we’ve got to use a “WordPress hook” as well. ? Which WordPress Hook to Use with wp_enqueue_style If not, please keep reading, we’ve got a great explanation for you. If everything in the code made sense to you, you can probably stop reading and copy-and-paste it. 'sp_sytlesheet', // A "name" for our file This function runs because of the add_action If you put this code in a theme, the biggest change you’ll need to make is $file_url will probably get defined using something like get_stylesheet_directory_uri instead. For me in the video, this code lives is in a plugin. This code if directly from the video above, but reformatted with added comments.
Video can’t be loaded because JavaScript is disabled: Load CSS Stylesheets in WordPress with wp_enqueue_style () wp_enqueue_style Example Code to Load Your Stylesheet, Nothing Else