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 to enqueue additional scripts and styles after loading another post into the DOM?
- remove_action or remove_filter with external classes?
- add_action reference a class
- How do I dequeue a parent theme’s CSS file?
- Why does save_post action fire when creating a new post?
- remove_action on after_setup_theme not working from child theme
- How to know what priority to use with add_action()?
- How to do_action and get a return value?
- Issues enqueueing parent & child theme stylesheets with revised Codex method
- Remove an action from an external Class
- Difference between do_action_ref_array() and do_action()
- Why is the Child Theme Stylesheet Not Loading?
- Can my “add_action” function know the name of the hook calling it?
- Why is there both a save_post and wp_insert_post action?
- Does the event ‘wp_version_check’ even exist? What is it doing?
- When is admin_init Action ran?
- Can an action callback prevent the parent from continuing execution?
- remove_action in a theme
- add_action ‘manage_posts_custom_column’ in a class [closed]
- How do I enqueue a script to run inside the Gutenberg editor?
- How can I find out what functions are assigned to actions?
- Unable to prevent function using save_post firing twice
- Difference between do_action(‘admin_enqueue_scripts’, $hook_suffix) and do_action(“admin_print_styles-$hook_suffix”) syntax
- Cron jobs in a class
- Add something to beginning of the content
- Disable WooCommerce action
- Give priority to child theme stylesheet
- How can I remove the WP menu from the admin bar?
- When and Where to use wp_insert_post()
- Why, Where, and When to use reference pointers in filters/hooks?
- Get parent theme version
- How to use parent theme’s enqueue methods
- add_action customize_register not working
- Passing arguments into ‘init’ function
- Add a Custom Field in Comment Box AFTER text area BUT BEFORE Send button
- How to use conditional add_action for WordPress
- Using wp_insert_post and post_update_meta but need to fire save_post afterward
- WP Schedule Event – Every Day When First Visitor Comes
- enqueuing React script and hooking its target div fails to load script
- wp_logout action not working
- How to remove an action that is added inside a class
- Having an add_action( ‘user_new_form’,) [closed]
- How to maintain wp_enqueue_style dependencies set in parent theme style enqueuing
- Using auth_redirect returns cannot modify header information
- Reuse variable in hook callback
- add action which returns modified value
- Remove action within a class in a parent theme from the child theme
- What would cause the ‘wp’ action to fire twice per page (but only once per post) in Firefox only?
- Problem:Save Several Duplicate posts in The Database and then Error nesting level of ‘100’ reached
- How to remove an action added by a child theme of Genesis
- I don’t understand why I need a lower priority to remove an action with a higher priority to make it work
- WordPress admin WP_table_list show incorrectly
- How Can I Use A Child Theme Effectively When Parent’s CSS Is Located in a ‘CSS folder’?
- How to dequeue / deregister parent theme style
- I created a child theme and it doesn’t work for some of the css files
- wp_get_attachment_metadata returns false with add_action() ‘add_attachment’ hook
- How to add a checkbox inside the “Publish post” widget?
- Disable child theme css on certain pages
- Enqueue styles properly in a child theme and stylesheets location
- Manually add admin bar
- Child Theme Not Overriding Parent Theme
- Is there a way to expose additional fields to the Bulk Action > Edit functionality?
- How can I enqueue a style only when a particular widget is active?
- What’s the usage of action do_meta_boxes?
- How can I invoke an action after a CiviCRM triggering event?
- Custom bulk actions in WP 3.7.1
- Remove action from a plugin class
- do_action pass array argument as reference not copy [duplicate]
- Style.css in child theme is loaded before Bootstrap
- how can I use add_action with external class which the function contain 2 argument?
- remove_action not working with procedural function
- Why Should We Use wp_clear_scheduled_hook and What it Does?
- 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
- How to override enqueued styles using a child theme
- How to check if an action is already fired?
- Dequeue only stylesheets but not inline style added using wp_add_inline_style
- Understanding child theme functions.php
- add_action and wp_head not display content in head section
- Scheduled event won’t fire
- Which action fire in front-end single post only
- De-registering parent style sheet css recommended?
- When should I call add_settings_section and add_settings_field?
- Enqueue stylesheets if parent theme has more than one .css file
- Unable to show error message using wp_login action
- Usage of do_action and add_adction
- array of objects to do_action, callback gets singular object?
- Preventing frontpage to be deleted/moved to trash
- WP action is not triggering a do_action() call within?