Child theme enqueue parent or dequeue

I am trying to understand the difference between the following scenarios and it’s impact on child theme

  1. I didn’t put any enqueue parent theme styles instructions or dequeue parent theme styles in my functions.php in my child theme (it’s currently empty). In this situation I am able to use styles.css in my child theme to add styles to my child theme. When I view source I still see bunch of links to CSS styles and JavaScript from parent theme. But because I didn’t enqueue them they have no effect on my child theme. Is that correct?

  2. Since I don’t need any of parent CSS styles or JS, what’s the best way to dequeue (de-register) them so that I can only work with my child theme style.css?

This is how I understand child themes (please feel free to correct me if I am wrong):

A child theme is a layer on top of the parent theme. So your child theme will over-ride the parent theme. For a simple example, if the parent theme has two functions, a and b, and the child theme has a function b, the website will use the function a from the parent theme, and replace the parent function b with the child function b. This also applies to enqueuing scripts.

The same thing goes for styles. So your website will use the styles from the parent theme, if you do not override them with corresponding styles from the child theme.

Check out the documentation at https://developer.wordpress.org/themes/advanced-topics/child-themes/ .

1 Like

I don’t need any styles from parent theme because I want to implement my own CSS and JS. Thanks for the link @WebMachine . I already took some time to read through. I guess I am gonna try just to dequeue styles and JS…then I can try modifying wp_nav so that it outputs menu mark up the way I need…

I guess my main question is do I have to dequeue parent styles and JS in case I don’t need them or just don’t mention any reference to them (don’t enqueue parent and child ) in my child theme function.php…since child theme style.css works anyway…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.