You could do it like this:
function theme_styles(){
/*
* This if() statement is unnecessary, as wp_enqueue_scripts
* doesn't fire on the admin pages.
* if( is_admin() ) {
* return;
* }
*/
wp_enqueue_style(
'theme-styles',
get_template_directory_uri() . '/css/all.css',
array(),
false,
'all'
);
}
add_action( 'wp_enqueue_scripts', 'theme_styles' );
References
Also, note that the wp_enqueue_scripts
hook is used to enqueue both scripts and styles.
Related Posts:
- Why I can’t add a CSS style in this WordPress theme?
- How important is it to enqueue a theme’s stylesheet?
- Enqueue a stylesheet for login page and make it appear in head element
- The difference between calling wp_enqueue_scripts to load scripts and styles in custom theme
- What can I hook into after_setup_theme?
- Adding inline styles from a widget
- Can’t edit style.css in subdirectory of my theme?
- De-registering parent style sheet css recommended?
- Sub folder CSS that’s read by Admin panel
- enqueue_style is not working
- Dequeue a style file which is making website load slow!
- Is my approach to enqueue styles inefficient?
- functions.php not hooking up with style.css
- How to add Bootstrap Tour JavaScript to WordPress Admin Panel Dashboard Widget
- Theme Loading Into Dashboard
- How to check if a WordPress core block is active in sidebar
- Font Awesome 5 Free – far working but fas is not? [closed]
- How remove render blocking css from wordpress when you build a theme?
- How do I use a color from theme options?
- Ideal inline dynamic CSS injection
- Having issue with WordPress wp_enqueue_style
- theme style is applied on the dhasboard rather than the website
- Adding google fonts to WordPress theme
- Advanced method to control cache of enqueued style/script
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- Enqueue script/style with multiple GET parameters
- Enqueuing a script before anything else
- Why is my CSS not loading?
- How to remove ID’s from wp_enqueue_style?
- How to rotate every letter in a title
- Custom Plugin – CSS works, JS doesn’t
- Theming Using Bootstrap Glyphicons and WordPress Dashicons
- Overide enqueue in non plugable function via child theme
- How to register and enqueue JavaScript files without breaking plugin dependencies?
- Some questions about how proper add 2 CSS file in a WordPress theme?
- How to include a file only on dashboard widgets page?
- Broken theme, template is missing
- JQuery undefined and Stylesheet loads in bottom along with js files
- How do I use wp_nav_menu?
- How can I wrap all blog posts image with
- How to fix : Uncaught ArgumentCountError: Too few arguments to function? [closed]
- I’m using wp residence theme and want to display titile above the slider [closed]
- How can I force Dynamic CSS via ACF values to update on page load?
- Iris color picker in custom theme option page not saving value
- White screen when attaching css to function.php
- Assign custom classes to the divs inside the loop
- Are there any caveats to compiling all of my theme’s SCSS into the style.css file in the theme root?
- SVG in list-style-image breaks when adding fill
- functions.php – inject inline css from file
- WordPress theme resource won’t load over VPN
- Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?
- How to enqueue a script which is type module without using script_loader_tag filter?
- enqueing Javascript and CSS
- theme-independent CSS/JS files
- I can’t add CSS with functions.php
- Load custom CSS before admin CSS
- Theme JS is available but theme CSS isn’t
- How to style bootstrap container in wordpress theme?
- Including CSS files in HEAD based on page content
- WordPress Child theme fails to override parent theme css
- CSS added through customizer neglects the need of a child theme?
- How to override template files in parent theme?
- Custom jquery not code not working in wordpress
- I want to set global directory locations for my CSS and JS locations. How?
- Custom admin logo not showing after wordpress 4.5 upgrade
- LESS not working in WordPress [closed]
- Place title (in correct place) above image with opaque background [closed]
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- multiple html/css files for wordpress theme?
- CSS preprocessor file messed up after compiled
- add jquery file if a certain page is included
- Customize Option Framework
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- Some doubts about WordPress handle the horizontal main menu visualization
- How to create a WP theme that use BootStrap? [closed]
- Can’t change theme name
- my single.php is mixup on some post for no reason
- How to use the _S framework
- header, stylesheet not being read
- Tiny MCE custom styles, and preview in the backend
- How to format the first line of a post differently?
- .current_page_ancestor broken in Twenty Eleven
- WordPress Animation Adjustments
- Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
- style variations hurt the editing performance
- How to create a robust and logic class naming system in WordPress theme developing?
- Dequeue styles with query doesn’t work
- Why nav_menu_css_class doesn’t work with apply_filters?
- how can i remove js file from my footer in wordpress
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- How do I change the color of individual page titles in WordPress?
- Displaying front side empty with one file attached problem
- 3 Level Menu Navigation (3rd Level not displaying)
- Default customizer colors aren’t displayed outside of the preview
- Test CDN link from function.php or wp_enqueue_script/style?
- Find the source file causing a Mixed Content warning
- Bootstrap Integtration
- How to reduce the vertical space above and below a ul list uniformly with one command?
- Is there a way to add classes to a page when using a Gutenberg reusable block as page layout?