You can try below code. I think there is no need to use wp_enqueue_scripts
twice to enqueue the parent and child theme style sheets separately. Also the use of echo get_stylesheet_uri( );
in the enqueue_child_theme_styles
function doesn’t make any sense.
function my_theme_enqueue_styles() {
$parent_style="styles";
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css', array('enough_base') );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
Make sure that you replace the parent-style
with the same $handle
used in the parent theme when it registers its stylesheet. You can refer following link for more details. https://codex.wordpress.org/Child_Themes
Related Posts:
- Remove parent theme action in child
- use add_action(‘wp_head’) in a widget
- How to call a static function in add_action() inside another static function?
- Why is my css and js not enqueued until footer?
- Remove action not working in child theme
- How do I dequeue js/css at the last possible moment?
- Font Awesome not loaded on first page of website only – divi theme
- How do I dequeue a parent theme’s CSS file?
- Issues enqueueing parent & child theme stylesheets with revised Codex method
- Remove an action from an external Class
- Why is the Child Theme Stylesheet Not Loading?
- How do I enqueue a script to run inside the Gutenberg editor?
- Why, Where, and When to use reference pointers in filters/hooks?
- How to use parent theme’s enqueue methods
- add_action customize_register not working
- Passing arguments into ‘init’ function
- Using wp_insert_post and post_update_meta but need to fire save_post afterward
- How to remove an action that is added inside a class
- Problem:Save Several Duplicate posts in The Database and then Error nesting level of ‘100’ reached
- How to add a checkbox inside the “Publish post” widget?
- What’s the usage of action do_meta_boxes?
- How can I invoke an action after a CiviCRM triggering event?
- Remove action from a plugin class
- How are updates to the style.css file in child theme recognized?
- Woocommerce Change placement with wrapper
- Modify query in pre_get_posts action is messing up my nav menu
- How do I set up a child-theme without using @import
- Find a Parent Theme’s stylesheet $handle when it registers a stylesheet
- Exclude trash from save_post
- Which action fire in front-end single post only
- array of objects to do_action, callback gets singular object?
- Selectively applying action based on role
- ERROR MESSAGE: Missing index.php—Child Theme
- Which action is triggered when a theme was modified?
- Is my child theme working properly
- Child theme style repeated
- Deregister scripts on unnecessary pages using remove_action
- how can I use add_action run another function when publishing new post?
- Performance : Duplicating `add_action`
- add_action in class and use it in theme
- How to track post number on the_loop
- How can I trigger actions manually?
- Better action hook for creating table than after_switch_theme and switch_theme action hook
- Parent theme CSS overriding child CSS rules
- Confused about how to use wp_enqueue_style
- $GLOBALS[‘hook_suffix’] variable empty
- publish_post action hook not working
- add_action and do_action: multiple calls to same callback?
- Gutenberg – Dispatch action or setAttributes() on Post Save/Update action instead of onChange listener
- Using Nested add_action()
- WordPress action admin_post for non-admin authenticated users – Form submission
- Instantiating classes through add_action and saving them to user_meta data [closed]
- Removing an action from wp_footer called in a class that’s inside a bigger class
- Reuse variable in hook callback
- how to add submenu item under parent menu item with code
- Child theme stylesheet not always overriding “index”
- Add “add to cart” button in WooCommerce [closed]
- Call do_action class’s function
- cannot filter after using pre_get_posts
- Child Theme CSS not showing at all
- missing argument 2 when passing arguments to add_action
- Display Something in the Header After All Styles are Loaded
- is there an update_post_meta action
- comment_post callback function: how to run it in the background.
- Add new users to “add new user” page on admin’s dashboard
- add_action( ‘publish_pelicula’, ‘post_published_notification’, 10, 2 ); does not trigger propperly
- Parent theme styles overriding child theme CSS [closed]
- Remove action in a parent theme from the child theme
- Remove action within a class in a parent theme’s includes folder from the child theme
- How to make child theme in wordpress with wp_enqueue_style ? Using Enough Theme
- save_post not triggered when a post is updated
- 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
- Action ‘init’ function doesn’t return variable
- Insert Google authorship into WordPress header
- How can I get more out of `$post` in an `add_action` callback?
- Why does using wp_register_style without wp_enqueue load and print CSS tags in the front-end?
- WordPress sent multiple requests on update
- Add Tag to post after publishing
- remove_action from parent theme using child theme functions.php
- Dequeing Parent Fontawesome Deques Parent Styles
- Remove Stylesheet by URL that has not been enqueued
- How to enqueue multiple style sheets into my child theme in wordpress (oceanwp)
- Call to Action Button – Resize Help [closed]
- My Child Theme CSS Isn’t Working
- wpdb->insert creates duplicate rows
- Remove action from plugin
- Need data from two different actions
- Adding a conditional to work on certain pages/page templates to an add_action()
- Why is this require statement not working?
- Adding add_action function
- XML Imported Custom Posts
- Invoke a function before the action hook
- save_post action not firing when save
- WooCommerce wp_insert_post action firing on every save
- How to enable/disable a hook with theme options
- Building WP Web App: Creating a Feed for post revisions
- Can admin_bar_menu or another action be used to modify the admin bar on the admin side?
- Browser stacks different versions of style.css
- What is the first action or filter executed by wordpress?
- How to fix enqueue_styles error for a twenty-seventeen childtheme