wp_enqueue_style $dep argument does nothing?

I’m trying to make a child theme of the twentyseventeen theme. I started by making a style.css with the content:

/*
Theme Name: John Tries This
Template: twentyseventeen
*/

I then made this functions.php

<?php
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {

$parent_style = ‘parent-style’; // This is ‘twentyseventeen-style’ for the Twenty Seventeen theme.

wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’,get_stylesheet_directory_uri() . ‘/style.css’
// ,array( $parent_style )
);
}

What I don’t understand is the 3rd argument of wp_enqueue_style. You see that I have it commented out. My web page shows all my parent styles and templates regardless of whether or not I comment out the ,array($parent_style).

So what exactly does this 3rd argument do? The wordpress documentation says it is a list of dependencies. Why should I provide dependencies? What behaviour will it alter?

Read more here:: wp_enqueue_style $dep argument does nothing?

Leave a Reply

Your email address will not be published. Required fields are marked *