Are you sure the version is included in style.css
in the right way? In that case this should really work (hook with wp_enqueue_scripts
):
$theme_data = wp_get_theme();
wp_register_style('your-style-handle', get_template_directory_uri() . '/style.css', '', $theme_data['version'], 'all');
wp_enqueue_style('your-style-handle');
While developing you may not want to change the file version in style.css
all the time, in which case you could use filemtime( get_template_directory_uri() . '/style.css' )
in stead of $theme_data['version']
in above code. Codewise that would be the proper thing to do. Otherwise, beware of browser cache issues.
Related Posts:
- De-registering parent style sheet css recommended?
- filemtime(): stat failed warning within a child theme
- how can I add an icon/image for a child theme?
- My child theme doesn’t work Error: “The parent theme is missing. Please install your parent theme”
- How to add Color Picker in Theme Options for the following?
- Adding customizer styles with wp_add_inline_style
- How to edit bbPress template files – WordPress + BuddyPress + bbPress? [closed]
- Best practices – Should I create a child theme vs. customizing a framework theme? (such as HTML5 reset)
- Child Theme not loading parent CSS
- What can I hook into after_setup_theme?
- add_image_size is scaling, even though crop is set to true
- How do I get my child-theme to work with my theme’s includes folder?
- Adding inline styles from a widget
- The best way to add stylesheets to WordPress
- How do I get a parent theme modification from a child theme?
- CSS in child theme not overriding the parent theme [closed]
- Advantages of using instead of wp_enqueue_style()?
- How to add dynamic inline style?
- Optimal solution to develop a wordpress theme?
- Enqueued Stylesheets Effecting Admin Styles
- When developing a distributable Theme, does it HAVE to be “inheritable”?
- Nesting Functions within Functions
- Should I update my _s theme?
- Create a theme by combining a parent and a child theme
- Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
- WordPress Multisite: Have the same header and footer of main-blog on all sub-blogs
- Override Constants in Child theme
- Am I supposed to create a child theme for every theme I use?
- enqueue_style is not working
- Child themes: disabling the parent
- How to Edit the style of header title of Twenty Eleven Theme?
- Is my approach to enqueue styles inefficient?
- Cannot figure out how to overwrite files in child theme
- How to add theme support?
- Removing non native customizer settings from a child theme
- How can I let templates choose which stylesheets are enqueued?
- Link to a .po file in a child theme
- Alias to theme folder for local development
- Inheritance of parent theme plugin files in a child theme
- Divi Child Theme not appearing in “Themes” [closed]
- Injecting a custom sql query into a page/theme
- Select full Image Size on widget “Genesis – Featured Posts”
- Child theme enqueue scripts using new functions
- Font Awesome 5 Free – far working but fas is not? [closed]
- changing blog title to an image using filter function in child theme
- Show woocommerce categories on my theme menu styling
- How remove render blocking css from wordpress when you build a theme?
- Child Theme’s style.css not loading in mobile browser
- How to properly create a child theme
- Renaming a theme so it aids SEO and the theme used is hidden
- Overrite parent functions using child functions
- Child Theme header1.php file not overwriting parent theme’s header1.php file
- Need help with adding templates (archives and sitemap) to WordPress child theme
- Will my site get messed up when the wordpress theme updates if I edited the html code in the editor to change footer?
- How to correctly enqueue the parent and child theme stylesheets in the creation of a child theme? [duplicate]
- Overide enqueue in non plugable function via child theme
- Having issue with WordPress wp_enqueue_style
- Starting point for custom Themes [closed]
- Making a child theme for “Airi”
- How to change footer credit text in Twenty Twenty One theme with a hook?
- Why still output /wp-content/themes/twentynineteen?
- Do I need to create a child theme for JointsWP
- Why is switching between themes breaking my child theme?
- How to override template files in parent theme?
- jQuery from parent theme loaded with many other scripts in a single min.js file
- Is There A WordPress Hook for Accessing Attachments for A Particular Page?
- Unable to change the priority with ‘remove_action’ and ‘add_action’ in child theme
- LESS not working in WordPress [closed]
- Translate a child theme with pure PHP and gettext
- Different themes on one site
- Remove h1 from 2015 theme
- Add content after get_header
- Adding google fonts to WordPress theme
- Displaying front side empty with one file attached problem
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- What is an alternative to not using child theme to customize a WordPress theme?
- Block validation failed for `core/pullquote` after adding theme support for editor-color-palette
- Where i must put hooks in overridable functions?
- How to show metabox on page if it is using a template
- Is_single not working properly in genesis
- How to test another theme in a live WordPress website instead of live preview?
- Debugging slow WordPress Theme Customizer (Any option similar to Query Monitor)?
- Editing Them with Child Theme Basics [closed]
- Child theme in separate WordPress Install
- Change header image on a particular page
- Update modified Shopify third-party theme [closed]
- Providing updates to your WordPress theme
- How to show children pages as array
- Hook in parent theme Menu function
- How do child themes work?
- Protecting work on client’s web host
- Why WordPress gets old templates code instead of the last updated ones
- adding navigation to genesis themes
- How to output wp_enqueue_style() in HTML head instead of footer
- What to do when child theme is out of date with parent theme
- Extracting Distance from FacetWP Proximity Function to Display in WordPress Template
- Enqueue script/style with multiple GET parameters
- Image Size wrong during upload
- Twenty sixteen – full height
- ways to create customized theme (hard coded – no pagebuilder)