I think you can try with this code below.
function childtheme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->parent()->get('Version') );
wp_enqueue_style( 'child-style',
get_stylesheet_uri(),
array( 'parent-style' ),
wp_get_theme()->get('Version') // Note you must provide a version into the child theme
);
}
add_action( 'wp_enqueue_scripts', 'childtheme_enqueue_styles' );
Related Posts:
- I created a child theme and it doesn’t work for some of the css files
- Child Theme Not Overriding Parent Theme
- How to override enqueued styles using a child theme
- Parent theme styles overriding child theme CSS [closed]
- get_template_directory_uri() links to child theme not parent
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- Looking for Functions File that doesn’t Exist
- Add custom css file after plugin css with WordPress Child Theme functions.php
- How do I create a child theme from PowerMag theme
- Child Theme not loading multiple stylesheets
- How to customize the_archive_title()?
- How to override parent functions in child themes?
- remove_action on after_setup_theme not working from child theme
- Remove type attribute from script and style tags added by WordPress
- Adding a second email address to a completed order in WooCommerce [closed]
- Include files in child theme functions file
- Child theme functions.php do I use php open and close tags?
- Declaring an instance of class included in parent theme from child theme functions.php
- Implementing DNS Prefetching with WordPress
- Child theme – overriding add_image_size by a child theme [duplicate]
- Is it possible to override this function/class in a child theme?
- TinyMCE custom stylesheets for different post types
- Change parent theme file function in child themes functions.php
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- Reuse variable in hook callback
- How to override filter in child theme?
- Unregister Nav Menu with fallback?
- Changes to functions.php not working
- Overwrite Parent Theme add_image_size in Child Theme
- Why is my Gutenberg block returning an error after initial save?
- If is multiple page templates
- Proper way of using functions in action hook?
- Debugging with functions.php
- how to edit functions.php in a child theme
- Register and enqueue style.css custom theme
- Include files in child themes, declare in functions.php
- How to remove set_post_thumbnail_size() in child themes?
- Echo tags used to describe the theme
- Child theme within a child theme?
- How can I change a function in a parent theme via a child themes functions.php
- Warning: : DOMDocument::loadHTML(): Empty string supplied as input in functions.php when adding classes to post images
- Remove stylesheets from Campaign Monitor plugin
- Pagination in relation to archive.php
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- Connecting to a 2nd DB gives me no results when querying
- debugging errors.. how to remedy?
- Load custom css in functions.php causing library issue
- Scripts not loading when using the wp_enqueue_scripts action
- Some questions about how proper add 2 CSS file in a WordPress theme?
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- How to edit classes in body tag?
- Can’t locate custom image sizes defined by child theme
- Can’t switch to a child theme using filters template, option_template and option_stylesheet
- Theme JS is available but theme CSS isn’t
- overwrite code snippet from parent to child theme
- Unable to point the child theme directory even using get_stylesheet_directory()
- How to edit/replace Parent functions.php function in Child Theme to add “Walker” class
- Child theme function.php causes fatal error
- How to pass variables from one function to another or combine functions
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- child parent styles enqueue order
- How to override this theme function in child theme
- get_template_directory() – references parent theme directory
- Strange error from functions.php files (wp_register_script)
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- Any adverse effects of adding apply_filters to a function?
- Get webpack to work on child theme
- How to remove font awesome from loading in wp theme
- Advanced method to control cache of enqueued style/script
- Adding a schema code to one specific page using functions.php file
- How Do I Unhook This Parent Theme Function?
- Test CDN link from function.php or wp_enqueue_script/style?
- Widget is displayed in two places
- How to make the RTL.css the dominant css code?
- Child theme, how to cut the functions.php file into several classes?
- Setting Up Child Theme To Take Priority
- Create New User Custom Field not Saving
- How would I correctly implement a new if statement in a child functions file?
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- I’m getting invalid taxonomy in init action
- Modified functions.php in Magazine Pro theme of Genesis. 500 error
- Help with is_page() and calling css for specific pages in a Child Theme
- Why is style.css not loading through the functions.php
- Javascript and Stylesheet in child page
- How do I integrate my Child Theme into a Custom Template?
- Getting back a blank WordPress site following functions code edit
- Child Theme functions.php has no effect
- custom post with loading script per single post
- Is it possible to change parameters of Parent theme function in the Child theme?
- Preventing PHP Execution in Parent Theme
- Why does my visual post editor break when I try to add a TinyMCE button?
- Unregistering custom tinymce plugin?
- Override parent theme function that is not hooked or in the functions.php file
- using enqueue_script in a shortcode isn’t working
- Why does modifying my functions.php file always result in a server error
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Problem with Child-Theme using of foundation-framework [closed]
- Why functions metaboxes is causing White Screen in Admin [closed]
- Comment turned Invisible
- post_row_actions filter from parent theme not executing in child theme