wp_enqueue_style $dep argument does nothing?

by John   Last Updated August 13, 2019 22:08 PM

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?

Tags : themes


Related Questions


How to prevent redirect after theme activation?

Updated April 06, 2015 17:03 PM

Getting headers property from WP_Theme object

Updated March 29, 2015 15:02 PM

What would a similar theme to this site be?

Updated April 13, 2015 00:03 AM


Creating a boxed layout

Updated May 06, 2015 02:03 AM