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
- How to add CSS class to custom logo?
- Solutions for generating dynamic javascript / CSS
- How to add stylesheets only to pages with specific shortcode?
- Adding customizer styles with wp_add_inline_style
- Why max-width:97.5% on content images?
- why does twenty eleven theme mix up the css measurement units?
- Setting up partial Right-to-Left admin interface
- How do I load custom scripts and styles for a page?
- Adding dashicon fonts to the admin of pre 3.8 installs
- How to Handle CSS for Multiple Header header.php Files?
- Move my theme style.css into a folder
- There’s an image named g.gif somewhere in my WordPress site
- How to highlight the current page in the nav menu?
- How to regenerate thumbnails when they’re stored on S3
- Whats the safest way to output custom JavaScript and Css code entered by the admin in the Theme Settings?
- Getting jquery to work with custom theme
- WordPress 5.8 update problem custom theme styles are overridden by core styles common.min.css
- CSS won’t style output of wp_nav_menu() correctly
- Is it necessary to prefix every css class in a theme framework?
- Warning/Error in Admin Panel while developing theme
- Is there a filter for enqueue script to strip the type=”text/javascript” property
- Weekly background code not working
- Including Javascript options
- way to include own functions independent of theme
- How to To Filter wp_enqueue_script() Scripts on Some Pages
- Multiple Page Templates & CSS
- How to insert html/css/javascript code to wordpress plugin
- How to add a button which saves the post then executes a function
- How to add material design css in wordpress and woocommerce
- enqueue styles for only mobile wp
- How to get javascript slider to work! [closed]
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- How to i style the elements from the TinyMCE
- Change the “Default Avatar” admin option via functions.php
- Enqueuing a script before anything else
- How to rotate every letter in a title
- 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
- enqueing Javascript and 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
- How to override template files in parent theme?
- LESS not working in WordPress [closed]
- Place title (in correct place) above image with opaque background [closed]
- CSS preprocessor file messed up after compiled
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- my single.php is mixup on some post for no reason
- How to use the _S framework
- style variations hurt the editing performance
- Why nav_menu_css_class doesn’t work with apply_filters?
- how can i remove js file from my footer in wordpress
- Displaying front side empty with one file attached problem
- Default customizer colors aren’t displayed outside of the preview
- Bootstrap Integtration
- How to generate a rtl.css file for themes?
- Load multiple css simultaneously using functions.php
- overlay post title over post’s featured image
- Change site title color on individual pages
- Enqueue Stylesheets After Theme’s “rtl.css”
- WordPress 3.5 + Foundation 5 not working on IE9
- Any disadvandages if I style the wordpress align classes without img and .wp-caption prefix
- enqueue script if page is not equal to
- adding navigation to genesis themes
- admin_print_styles incuding $_SERVER[‘DOCUMENT_ROOT’]
- Header is not showing full width
- How to resize video lightbox popup in wordpress? [closed]
- How can I get rid of the distance when I’m using list-style-type: none? [closed]
- Theme now uses require.js and enqueue script no longer works
- HTML to WORDPRESS [closed]
- WordPress search field won’t get wider